On Tue, 18 Dec 2001, Colin Capriati wrote:
> For brevity you could also try:
>
> application.setAttribute("errorMessage",new String("NO Error Message"));
I believe that what you (and Mark) suggest is functionally equivalent
to what the original poster had, but they are less efficient, because
there is more object creation going on (and superfluous object
creation at that). So they are unnecessary and less preferred.
Like I said before (or tried to say :-), double quoted string literals
should be perfectly acceptable whereever a String object can be (and a
String is an Object).
> ----- Original Message -----
> From: "Mark Galbreath" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, December 18, 2001 12:51 PM
> Subject: Re: Communication between JSP and servlets
>
>
> > Look at the API - setAttribute() takes a String and an Object, not 2
> > Strings. Try something like:
> >
> > String errorMessage = "NO Error Message";
> > application.setAttribute( "errorMessage", errorMessage);
> >
> >
> > Cheers!
> > Mark
> >
> > -----Original Message-----
> > From: Jim Lindsay
> > Sent: Tuesday, December 18, 2001 2:49 PM
> >
> > I am not able to get session or application scope tracking to work for
> some
> > reason. Currently the code is trying to use
> > application tracking, but I know I should be using session tracking for
> > items that are for the user session.
> >
> > In my userLoggidIn.jsp page I have:
> > Error Message = < <%= application.getAttribute("errorMessage") %> >
> >
> > In my servlet I have:
> > application.setAttribute("errorMessage", "NO error message");
> >
> > esponse.sendRedirect( response.encodeRedirectURL("/userLoggedIn.jsp");
> >
> > The output is *always*: "Error Message = < null >". What the heck am I
> > doing wrong?
> >
> >
> ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html