Sorry, the organization-person in me rebelled when seeing this code:

> >     session.setAttribute("USER", szLoginName);
> >     session.setAttribute("APPLICATION", new Integer(appID));
> >
> >     RequestDispatcher rd =
> > getServletContext().getRequestDispatcher("index.jsp");
> >       rd.forward(request,response);

Pardon the curmudgeon, but YIKES! YICK! SPIT! BLEAH! This is without looking 
at the code, which I haven't bothered to do, but cursory glances at the code 
makes me react. Note the variable names: "appID", "rd", "request", 
"response"... "szLoginName". Somewhere there's a documentation project 
that's spinning in its grave. I really hope nobody uses this kind of mixing 
and matching in the real world, because if so, there's a project doomed to 
horrible maintenance costs. I rarely say "never do..." but NEVER DO THIS. 
Java is strongly typed, which eliminates the need for Hungarian; "rd" is a 
short form, while "request" is a long form... Lady Consistency is begging 
for "loginname", "request", "response", "dispatcher" or "name", "rd", "req", 
"resp", or even "nLogin", "rqUser", "rspUser", "dispIndex". (If you're GONNA 
use Hungarian, use it right and avoid embedding the useless implementation 
types into the names, which is a bastardization of Hungarian notation 
itself, hard to imagine as it is.)


>From: "Conway. Fintan (IT Solutions)" <[EMAIL PROTECTED]>
>Reply-To: "JDJList" <[EMAIL PROTECTED]>
>To: "JDJList" <[EMAIL PROTECTED]>
>Subject: [jdjlist] RE: RequestDispatcher.forward method creating a new Ses  
>    sion.
>Date: Mon, 2 Sep 2002 10:12:41 +0100
>
>Try using :
>
>               session.putAttribute("USER", szLoginName);
>               session.putAttribute("APPLICATION", new Integer(appID));
>
>Regards,
>
>Fintan
>
> > -----Original Message-----
> > From:       Rajesh Kumar Ilango, Gurgaon [SMTP:[EMAIL PROTECTED]]
> > Sent:       02 September 2002 10:02
> > To: JDJList
> > Subject:    [jdjlist] RequestDispatcher.forward method creating a new
> > Session.
> >
> > Hi,
> > I am using Tomcat 4.0. I have the following code in a Servlet
> >
> >     session.setAttribute("USER", szLoginName);
> >     session.setAttribute("APPLICATION", new Integer(appID));
> >
> >     RequestDispatcher rd =
> > getServletContext().getRequestDispatcher("index.jsp");
> >       rd.forward(request,response);
> >
> >
> > In the index.jsp I was not able to access the "USER" and "APPLICATION"
> > attributes that I am setting in session object.
> >
> > Moreover session.getId() on both the page and the servlet reveals
> > different
> > session ID.
> >
> > Does any body has any idea why this is happening?
> > Similar forwards from JSP to JSP is working absolutly fine.
> >
> > Rdgs.
> >
> > _____________________________________________________________________
> > Rajesh Kumar Ilango
> >
> > To change your JDJList options, please visit:
> > http://www.sys-con.com/java/list.cfm
>
>
>* ** *** ** * ** *** ** * ** *** ** *
>This email and any files transmitted with it are confidential and
>intended solely for the use of the individual or entity to whom they
>are addressed.
>Any views or opinions presented are solely those of the author, and do not 
>necessarily
>represent those of ESB.
>If you have received this email in error please notify the sender.
>
>Although ESB scans e-mail and attachments for viruses, it does not 
>guarantee
>that either are virus-free and accepts no liability for any damage 
>sustained
>as a result of viruses.
>
>* ** *** ** * ** *** ** * ** *** ** *
>
>To change your JDJList options, please visit: 
>http://www.sys-con.com/java/list.cfm


-----------------------------------------------
Joseph B. Ottinger       [EMAIL PROTECTED]
http://enigmastation.com          IT Consultant

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


To change your JDJList options, please visit: http://www.sys-con.com/java/list.cfm

Reply via email to