I have a servlet that accepts values from a jsp and processes them, then
passes them back to another jsp through the session object. However, the jsp
that receives the values from the servlet displays those values as "null".
Now, if I have the servlet generate the output, the values display as
expected. Here's the code in  the servlet:

HttpSession session = req.getSession(true);
...code that processes values...
session.setAttribute("id", id_response);
resp.sendRedirect("http://localhost/results.jsp");


Here's the code in results.jsp that doesn't seem to work:

<html><head><title></title></head>
<body>
<%
        String v_id = (String) session.getAttribute("id");
%>
Here is the value <%= v_id %>
</body></html>

Now, as I explained, if I comment out the redirect statement and add this
code to the servlet (assuming, of course, I get the PrintWriter and so
forth), the values display as expected:

session.setAttribute("id", id_response);
out.println("Here is the value " + session.getAttribute("id"));
out.flush();

Can anyone help me understand this behaviour?

Thanks in advance,
[EMAIL PROTECTED]

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to