Hi,
I created a session object and added a string (username) to it.
Systemout.println shows the username from the request. My page is then
forwarded to another as follows:
RequestDispatcher disp = ctx.getRequestDispatcher(target);
disp.forward(request, response);
On this jsp
Can you please show how are you creating the session object???
Sincerely
Lic. Computer Science
Erlis Vidal Santos
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 09, 2003 10:44 AM
To: [EMAIL PROTECTED]
Subject: String added to session in
Howdy,
If you display the session ID before adding the user name, and then in
your JSP as you already do, are they the same session?
Yoav Shapira
Millennium ChemInformatics
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 09, 2003 10:44 AM
Can you please show how are you creating the session object???
No worries, here it is:
HttpSession session = request.getSession(true);
session.setAttribute(usr, request.getParameter(username));
Sincerely
Lic. Computer Science
Erlis Vidal Santos
-Original Message-
And how you get the session in your JSP??
Try this
HttpSession session = request.getSession(true);
String username = ( request.getParameter(username) != null ?
request.getParameter(username) : ) ;
session.setAttribute(usr, username);
Sincerely
Lic. Computer Science
Erlis Vidal Santos
Yoav,
Very good point. The sessionid from the servlet is different to the one in
the browser, as shown below.
Ser: 1DFADA80613F3BE01C86A5C6DE2501A8
jsp: AEAE6C4879702A3CF4254FF85B778D81
Rudi
Howdy,
If you display the session ID before adding the user name, and then in
your JSP as you
I really sorry the last message I sent it by mistake, is difficult to me
write code in outlook ;) well
Try this
HttpSession session = request.getSession(true);
String username = request.getParameter(username)
if ( username == null ) username = noParameter;
if ( .equals( username ) )
When i need to get session variables or objects i use Taglibs, its
do a good job.
--
De: [EMAIL PROTECTED]:[EMAIL PROTECTED]
Responder:Tomcat Users List
Enviada: quinta-feira, 9 de outubro de 2003 12:01
Para: Tomcat Users List
Assunto: RE: String
Sorry, not entirely sure what you meant.
I have copied your code and placed it in my servlet as follows:
HttpSession session = request.getSession(true);
String username = ( request.getParameter(username) != null ?
request.getParameter(username) : ) ;
No worries. I added the following to doPost in my servlet:
HttpSession session = request.getSession(true);
String username = request.getParameter(username);
if ( username == null ) username = noParameter;
if ( .equals( username ) ) username = noParameter;
Howdy,
That's your answer ;( Your code for getting the session is fine. Is
the RequestDispatcher forwarding to a different webapp?
Yoav Shapira
Millennium ChemInformatics
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 09, 2003 11:01 AM
Frames with sessions can be a complicated beast if cookies are
disabled:
- First make shure that you encode all frame url's in the top
level framset. Otherwise each frame will get his own session.
- After that make shure that all frames keep in sync with the
session id. The simple design
12 matches
Mail list logo