Hmm, shouldn't it be session.getAttribute(<String>) as opposed to
request.getAttribute(<String>)???
-Matt
-----Original Message-----
From: Ramakrishnan Venkataraman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 13, 2000 6:05 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Unable to use request.getAttribute() in a JSP page
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01BFED2F.97228FF6
Content-Type: text/plain;
charset="windows-1252"
Sorry, my typo(s).
I am using a single argument to getAttribute()
like this <%= request.getAttribute(<String>) %>
Same goes for request.getParameter(<String>) (Only one argument)
(Otherwise the JSP compile would have failed)
The generated Java code looks like:
out.print(request.getAttribute("sessionId"));
I thought this should work, but obviously I have something wrong somewhere.
- Venky
-----Original Message-----
From: jim moore [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 13, 2000 12:39 PM
To: jrun-talk
Subject: RE: Unable to use request.getAttribute() in a JSP page
getAttribute() takes only one parameter (a string): Object o =
request.getAttribute(String name);
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Ramakrishnan
Venkataraman
Sent: Thursday, July 13, 2000 12:57 PM
To: [EMAIL PROTECTED]
Subject: Unable to use request.getAttribute() in a JSP page
I am trying to forward a request from a servlet to a JSP.
To pass information from the servlet to the JSP page, I use
request.setAttribute(String, String) in the servlet.
To call the JSP page I do:
getServletConfig().getServletContext().getRequestDispatcher(<jsp
page>).forward(request, response);
But the JSP fails with the following error:
----------------------------------------------
500 Internal Server Error
com.livesoftware.jsp.JSPServlet:
java.lang.NullPointerException:
----------------------------------------------
In the JSP page I have expressions like <%=request.getAttribute(String,
String)%>.
I also simply tried to call the JSP page from the browser, that also gives
the same problem if I use <%=request.getAttribute(String, String)%> in the
JSP page.
(Incidentally if I do a redirect() to the JSP page passing a query string,
it works correctly (of course, in the JSP I then use
<%=request.getParameter(String, String)%> )
I am using JRun 2.3.3 on Win NT 4.0 server.
Any idea what I am doing wrong ?
Thanks in advance for any pointers.
- Ramakrishnan Venkataraman
Email: [EMAIL PROTECTED]
------_=_NextPart_001_01BFECEB.4F433EE0
Content-Type: text/html;
charset="windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dwindows-1252">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2651.65">
<TITLE>Unable to use request.getAttribute() in a JSP page</TITLE>
</HEAD>
<BODY>
<BR>
<P><FONT SIZE=3D2>I am trying to forward a request from a servlet to a =
JSP.</FONT>
</P>
<P><FONT SIZE=3D2>To pass information from the servlet to the JSP page, =
I use request.setAttribute(String, String) in the servlet.</FONT>
</P>
<P><FONT SIZE=3D2>To call the JSP page I do: </FONT>
</P>
<P> <FONT =
SIZE=3D2>getServletConfig().getServletContext().getRequestDispatcher(<=
;jsp page>).forward(request, response); </FONT>
</P>
<P><FONT SIZE=3D2>But the JSP fails with the following error:</FONT>
</P>
<P><FONT SIZE=3D2>----------------------------------------------</FONT>
<BR><FONT SIZE=3D2>500 Internal Server Error</FONT>
<BR><FONT SIZE=3D2>com.livesoftware.jsp.JSPServlet:</FONT>
</P>
<P><FONT SIZE=3D2>java.lang.NullPointerException: </FONT>
</P>
<P><FONT SIZE=3D2>----------------------------------------------</FONT>
</P>
<P><FONT SIZE=3D2>In the JSP page I have expressions like =
<%=3Drequest.getAttribute(String, String)%>.</FONT>
</P>
<P><FONT SIZE=3D2>I also simply tried to call the JSP page from the =
browser, that also gives the same problem if I use =
<%=3Drequest.getAttribute(String, String)%> in the JSP =
page.</FONT></P>
<P><FONT SIZE=3D2>(Incidentally if I do a redirect() to the JSP page =
passing a query string, it works correctly (of course, in the JSP I =
then use <%=3Drequest.getParameter(String, String)%> )</FONT></P>
<P><FONT SIZE=3D2>I am using JRun 2.3.3 on Win NT 4.0 server.</FONT>
</P>
<P><FONT SIZE=3D2>Any idea what I am doing wrong ?</FONT>
</P>
<P><FONT SIZE=3D2>Thanks in advance for any pointers.</FONT>
</P>
<P><FONT SIZE=3D2>- Ramakrishnan Venkataraman</FONT>
<BR><FONT SIZE=3D2> Email: [EMAIL PROTECTED]</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01BFECEB.4F433EE0--
----------------------------------------------------------------------------
--
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
----------------------------------------------------------------------------
--
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
------_=_NextPart_001_01BFED2F.97228FF6
Content-Type: text/html;
charset="windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dwindows-1252">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2651.65">
<TITLE>RE: Unable to use request.getAttribute() in a JSP page</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>Sorry, my typo(s). </FONT>
</P>
<P><FONT SIZE=3D2>I am using a single argument to getAttribute()</FONT>
</P>
<P><FONT SIZE=3D2>like this <%=3D =
request.getAttribute(<String>) %></FONT>
</P>
<P><FONT SIZE=3D2>Same goes for =
request.getParameter(<String>) (Only one argument)</FONT>
</P>
<P><FONT SIZE=3D2>(Otherwise the JSP compile would have failed)</FONT>
</P>
<P><FONT SIZE=3D2>The generated Java code looks like:</FONT>
</P>
<P> <FONT =
SIZE=3D2>out.print(request.getAttribute("sessionId"));</FONT>
</P>
<P><FONT SIZE=3D2>I thought this should work, but obviously I have =
something wrong somewhere.</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>- Venky</FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: jim moore [<A =
HREF=3D"mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>]<=
/FONT>
<BR><FONT SIZE=3D2>Sent: Thursday, July 13, 2000 12:39 PM</FONT>
<BR><FONT SIZE=3D2>To: jrun-talk</FONT>
<BR><FONT SIZE=3D2>Subject: RE: Unable to use request.getAttribute() in =
a JSP page</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>getAttribute() takes only one parameter (a string): =
Object o =3D</FONT>
<BR><FONT SIZE=3D2>request.getAttribute(String name);</FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: [EMAIL PROTECTED]</FONT>
<BR><FONT SIZE=3D2>[<A =
HREF=3D"mailto:[EMAIL PROTECTED]">mailto:JRun-Talk-req=
[EMAIL PROTECTED]</A>]On Behalf Of Ramakrishnan</FONT>
<BR><FONT SIZE=3D2>Venkataraman</FONT>
<BR><FONT SIZE=3D2>Sent: Thursday, July 13, 2000 12:57 PM</FONT>
<BR><FONT SIZE=3D2>To: [EMAIL PROTECTED]</FONT>
<BR><FONT SIZE=3D2>Subject: Unable to use request.getAttribute() in a =
JSP page</FONT>
</P>
<BR>
<P><FONT SIZE=3D2>I am trying to forward a request from a servlet to a =
JSP.</FONT>
</P>
<P><FONT SIZE=3D2>To pass information from the servlet to the JSP page, =
I use</FONT>
<BR><FONT SIZE=3D2>request.setAttribute(String, String) in the =
servlet.</FONT>
</P>
<P><FONT SIZE=3D2>To call the JSP page I do:</FONT>
</P>
<P> <FONT =
SIZE=3D2>getServletConfig().getServletContext().getRequestDispatcher(<=
;jsp</FONT>
<BR><FONT SIZE=3D2>page>).forward(request, response);</FONT>
</P>
<P><FONT SIZE=3D2>But the JSP fails with the following error:</FONT>
</P>
<P><FONT SIZE=3D2>----------------------------------------------</FONT>
<BR><FONT SIZE=3D2>500 Internal Server Error</FONT>
<BR><FONT SIZE=3D2>com.livesoftware.jsp.JSPServlet:</FONT>
</P>
<P><FONT SIZE=3D2>java.lang.NullPointerException:</FONT>
</P>
<P><FONT SIZE=3D2>----------------------------------------------</FONT>
</P>
<P><FONT SIZE=3D2>In the JSP page I have expressions like =
<%=3Drequest.getAttribute(String,</FONT>
<BR><FONT SIZE=3D2>String)%>.</FONT>
</P>
<P><FONT SIZE=3D2>I also simply tried to call the JSP page from the =
browser, that also gives</FONT>
<BR><FONT SIZE=3D2>the same problem if I use =
<%=3Drequest.getAttribute(String, String)%> in the</FONT>
<BR><FONT SIZE=3D2>JSP page.</FONT>
</P>
<P><FONT SIZE=3D2>(Incidentally if I do a redirect() to the JSP page =
passing a query string,</FONT>
<BR><FONT SIZE=3D2>it works correctly (of course, in the JSP I then =
use</FONT>
<BR><FONT SIZE=3D2><%=3Drequest.getParameter(String, String)%> =
)</FONT>
</P>
<P><FONT SIZE=3D2>I am using JRun 2.3.3 on Win NT 4.0 server.</FONT>
</P>
<P><FONT SIZE=3D2>Any idea what I am doing wrong ?</FONT>
</P>
<P><FONT SIZE=3D2>Thanks in advance for any pointers.</FONT>
</P>
<P><FONT SIZE=3D2>- Ramakrishnan Venkataraman</FONT>
<BR><FONT SIZE=3D2> Email: [EMAIL PROTECTED]</FONT>
</P>
<P><FONT SIZE=3D2>------_=3D_NextPart_001_01BFECEB.4F433EE0</FONT>
<BR><FONT SIZE=3D2>Content-Type: text/html;</FONT>
<BR> <FONT =
SIZE=3D2>charset=3D"windows-1252"</FONT>
<BR><FONT SIZE=3D2>Content-Transfer-Encoding: quoted-printable</FONT>
</P>
<P><FONT SIZE=3D2><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML =
3.2//EN"></FONT>
<BR><FONT SIZE=3D2><HTML></FONT>
<BR><FONT SIZE=3D2><HEAD></FONT>
<BR><FONT SIZE=3D2><META HTTP-EQUIV=3D3D"Content-Type" =
CONTENT=3D3D"text/html; =3D</FONT>
<BR><FONT SIZE=3D2>charset=3D3Dwindows-1252"></FONT>
<BR><FONT SIZE=3D2><META NAME=3D3D"Generator" =
CONTENT=3D3D"MS Exchange Server version =3D</FONT>
<BR><FONT SIZE=3D2>5.5.2651.65"></FONT>
<BR><FONT SIZE=3D2><TITLE>Unable to use request.getAttribute() in =
a JSP page</TITLE></FONT>
<BR><FONT SIZE=3D2></HEAD></FONT>
<BR><FONT SIZE=3D2><BODY></FONT>
<BR><FONT SIZE=3D2><BR></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>I am trying to =
forward a request from a servlet to a =3D</FONT>
<BR><FONT SIZE=3D2>JSP.</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>To pass information =
from the servlet to the JSP page, =3D</FONT>
<BR><FONT SIZE=3D2>I use request.setAttribute(String, String) in the =
servlet.</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>To call the JSP page =
I do: </FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT =
SIZE=3D2><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
;nbsp;&nbsp; <FONT =3D</FONT>
<BR><FONT =
SIZE=3D2>SIZE=3D3D2>getServletConfig().getServletContext().getRequest=
Dispatcher(&lt=3D</FONT>
<BR><FONT SIZE=3D2>;jsp page&gt;).forward(request, response); =
</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>But the JSP fails =
with the following error:</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT =
SIZE=3D3D2>----------------------------------------------</FONT>=
;</FONT>
<BR><FONT SIZE=3D2><BR><FONT SIZE=3D3D2>500 Internal Server =
Error</FONT></FONT>
<BR><FONT SIZE=3D2><BR><FONT =
SIZE=3D3D2>com.livesoftware.jsp.JSPServlet:</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT =
SIZE=3D3D2>java.lang.NullPointerException: </FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT =
SIZE=3D3D2>----------------------------------------------</FONT>=
;</FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>In the JSP page I =
have expressions like =3D</FONT>
<BR><FONT SIZE=3D2>&lt;%=3D3Drequest.getAttribute(String, =
String)%&gt;.</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>I also simply tried =
to call the JSP page from the =3D</FONT>
<BR><FONT SIZE=3D2>browser, that also gives the same problem if I use =
=3D</FONT>
<BR><FONT SIZE=3D2>&lt;%=3D3Drequest.getAttribute(String, =
String)%&gt; in the JSP =3D</FONT>
<BR><FONT SIZE=3D2>page.</FONT></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>(Incidentally if I do =
a redirect() to the JSP page =3D</FONT>
<BR><FONT SIZE=3D2>passing a query string, it works correctly (of =
course, in the JSP I =3D</FONT>
<BR><FONT SIZE=3D2>then use &lt;%=3D3Drequest.getParameter(String, =
String)%&gt; )</FONT></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>I am using JRun 2.3.3 =
on Win NT 4.0 server.</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>Any idea what I am =
doing wrong ?</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>Thanks in advance for =
any pointers.</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2><P><FONT SIZE=3D3D2>- Ramakrishnan =
Venkataraman</FONT></FONT>
<BR><FONT SIZE=3D2><BR><FONT SIZE=3D3D2>&nbsp; Email: =
[EMAIL PROTECTED]</FONT></FONT>
<BR><FONT SIZE=3D2></P></FONT>
</P>
<P><FONT SIZE=3D2></BODY></FONT>
<BR><FONT SIZE=3D2></HTML></FONT>
<BR><FONT SIZE=3D2>------_=3D_NextPart_001_01BFECEB.4F433EE0--</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------------=
-------------</FONT>
<BR><FONT SIZE=3D2>--</FONT>
<BR><FONT SIZE=3D2>Archives: <A =
HREF=3D"http://www.egroups.com/group/jrun-interest/" =
TARGET=3D"_blank">http://www.egroups.com/group/jrun-interest/</A></FONT>=
<BR><FONT SIZE=3D2>Unsubscribe:</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&body=3Dli=
sts/jrun_talk" =
TARGET=3D"_blank">http://www.houseoffusion.com/index.cfm?sidebar=3Dlists=
&body=3Dlists/jrun_talk</A></FONT>
<BR><FONT SIZE=3D2>or send a message to =
[EMAIL PROTECTED] with 'unsubscribe'</FONT>
<BR><FONT SIZE=3D2>in the body.</FONT>
</P>
<P><FONT =
SIZE=3D2>---------------------------------------------------------------=
---------------</FONT>
<BR><FONT SIZE=3D2>Archives: <A =
HREF=3D"http://www.egroups.com/group/jrun-interest/" =
TARGET=3D"_blank">http://www.egroups.com/group/jrun-interest/</A></FONT>=
<BR><FONT SIZE=3D2>Unsubscribe: <A =
HREF=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists&body=3Dli=
sts/jrun_talk" =
TARGET=3D"_blank">http://www.houseoffusion.com/index.cfm?sidebar=3Dlists=
&body=3Dlists/jrun_talk</A></FONT>
<BR><FONT SIZE=3D2>or send a message to =
[EMAIL PROTECTED] with 'unsubscribe' in the =
body.</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01BFED2F.97228FF6--
----------------------------------------------------------------------------
--
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.