tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weilu Yao" <yaowe...@hotmail.com>
Subject Servlet Breaks HttpSession among JSP pages?
Date Mon, 03 Jul 2000 18:36:34 GMT
Dear Gurus,

Please save me, otherwise I will be fired.

Let me state my problem using the following model.


I have two JSP pages: page_1.jps and page2.jsp.
In the first page, I  brought in a JavaBean
of type Person.  Person have only one property
called "name". I set property "name" in the
first page---page1.jsp. I set the scope of the Bean
as "session".

Now I hit my second JSP page--- page2.jsp. In this
page, I simply use the same bean but get property
"name" and display it.  I DID see the name in the browser.

So far, so good.

Now I add a HTML form in the first page with
its "action" pointing to /servlet/MyServlet".

<form method=get name="user"
      action="/servlet/MyServlet" >
<input type="submit" value="Go">
</form>

The doGet() method is implemented as follows:

RequestDispatcher rd = getServletContext().
     getRequestDispatcher("/page2.jsp");
rd.forward(req,res);

In another word,  MyServlet just  does a "forward".

At this stage, I lost luck. In the browser, I did not
see the person's name.

It seems to me that Servlet broke the HttpSession.
Could anybody please tell me why and how to cure?

Thank you in avance.

Wei Lu





________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message