我有一个jsp:
<body>
<h1>Hello World!</h1>
<form action="test1" method="post">
<input type="text" name="text" />
<input type="submit" name="submit" value="submit" />
</form>
</body>
servlet 1是:
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String text = request.getParameter("text");
System.out.println("text: "+ text);
RequestDispatcher rd1 = request.getRequestDispatcher("requesttest2.jsp");
rd1.forward(request, response);
}
jsp 2是:
<body>
<h1>Hello World!</h1>
<%
String text = request.getParameter("text");
out.println("text in second page"+ text);
%>
<form action="test2" method="post">
<input type="text" name="text1" />
<input type="submit" name="submit" value="submit" />
</form>
</body>
有两个jsp。我从jsp1获取值到servlet 1,然后将这些值传递给其他jsp。在第二个jsp我也获取其他值。现在我想在secone servlet中获取jsp 1和jsp 2的值,即servlet 2.
我不想使用seeion对象。请提出一些解决方案。