你的js写对了么你后台是否使用的是 doPost跳转的?
解决方案 »
- hibernate 类型转换错误
- 文件上传
- 跪求高手给我个免费的Java项目开发合作的机会!
- java 服务器时间校对
- 一个关于hibernate的空指针问题
- 求救:createEntityManagerFactory-- NoClassDefFoundError: org/hibernate/proxy/EntityNotFoundDelegate
- Java好学吗?
- 请教大家一个jdbc连接ms sqlserver的问题。
- 如何实现JAAS和Web声明安全性的结合?
- 关于请求转发过程中文件下载的问题
- struts多文件打包下载报错
- eclipse两个项目调试怎么跳到另外一个项目里面的同一个类
02.import javax.servlet.ServletException;
03.import javax.servlet.http.HttpServlet;
04.import javax.servlet.http.HttpServletRequest;
05.import javax.servlet.http.HttpServletResponse;
06.public class Hello extends HttpServlet {
07. /**
08. * Constructor of the object.
09. */
10. public Hello() {
11. super();
12. System.out.println("new Hello");
13. }
14. /**
15. * Destruction of the servlet. <br>
16. */
17. public void destroy() {
18. super.destroy(); // Just puts "destroy" string in log
19. // Put your code here
20. System.out.println("destroy");
21. }
22. /**
23. * The doGet method of the servlet. <br>
24. * This method is called when a form has its tag value method equals to get.
25. * @param request the request send by the client to the server
26. * @param response the response send by the server to the client
27. * @throws ServletException if an error occurred
28. * @throws IOException if an error occurred
29. */
30. public void doGet(HttpServletRequest request, HttpServletResponse response)
31. throws ServletException, IOException {
32. String text1 = request.getParameter("text1");
33. String str = text1;
34. response.sendRedirect("result.jsp?text1=" + text1);
35.}
36. /**
37. * The doPost method of the servlet. <br>
38. * This method is called when a form has its tag value method equals to post.
39. * @param request the request send by the client to the server
40. * @param response the response send by the server to the client
41. * @throws ServletException if an error occurred
42. * @throws IOException if an error occurred
43. */
44. public void doPost(HttpServletRequest request, HttpServletResponse response)
45. throws ServletException, IOException {
46. doGet(request,response);
47. }
48. /**
49. * Initialization of the servlet. <br>
50. * @throws ServletException if an error occure
51. */
52. public void init() throws ServletException {
53. // Put your code here
54. System.out.println("init");
55. }
56.}