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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>getServletConfig().getServletContext().getRequestDispatcher(&lt=
;jsp page&gt;).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 =
&lt;%=3Drequest.getAttribute(String, String)%&gt;.</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 =
&lt;%=3Drequest.getAttribute(String, String)%&gt; 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 &lt;%=3Drequest.getParameter(String, String)%&gt; )</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>&nbsp; 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 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;%=3D =
request.getAttribute(&lt;String&gt;) %&gt;</FONT>
</P>

<P><FONT SIZE=3D2>Same goes for =
request.getParameter(&lt;String&gt;)&nbsp; (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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>out.print(request.getAttribute(&quot;sessionId&quot;));</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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>getServletConfig().getServletContext().getRequestDispatcher(&lt=
;jsp</FONT>
<BR><FONT SIZE=3D2>page&gt;).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 =
&lt;%=3Drequest.getAttribute(String,</FONT>
<BR><FONT SIZE=3D2>String)%&gt;.</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 =
&lt;%=3Drequest.getAttribute(String, String)%&gt; 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>&lt;%=3Drequest.getParameter(String, String)%&gt; =
)</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>&nbsp; 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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>charset=3D&quot;windows-1252&quot;</FONT>
<BR><FONT SIZE=3D2>Content-Transfer-Encoding: quoted-printable</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML =
3.2//EN&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;HTML&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;HEAD&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;META HTTP-EQUIV=3D3D&quot;Content-Type&quot; =
CONTENT=3D3D&quot;text/html; =3D</FONT>
<BR><FONT SIZE=3D2>charset=3D3Dwindows-1252&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;META NAME=3D3D&quot;Generator&quot; =
CONTENT=3D3D&quot;MS Exchange Server version =3D</FONT>
<BR><FONT SIZE=3D2>5.5.2651.65&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;TITLE&gt;Unable to use request.getAttribute() in =
a JSP page&lt;/TITLE&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/HEAD&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;BODY&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;BR&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;I am trying to =
forward a request from a servlet to a =3D</FONT>
<BR><FONT SIZE=3D2>JSP.&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;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.&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;To call the JSP page =
I do: &lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT =
SIZE=3D2>&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp=
;nbsp;&amp;nbsp; &lt;FONT =3D</FONT>
<BR><FONT =
SIZE=3D2>SIZE=3D3D2&gt;getServletConfig().getServletContext().getRequest=
Dispatcher(&amp;lt=3D</FONT>
<BR><FONT SIZE=3D2>;jsp page&amp;gt;).forward(request, response); =
&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;But the JSP fails =
with the following error:&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT =
SIZE=3D3D2&gt;----------------------------------------------&lt;/FONT&gt=
;</FONT>
<BR><FONT SIZE=3D2>&lt;BR&gt;&lt;FONT SIZE=3D3D2&gt;500 Internal Server =
Error&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;BR&gt;&lt;FONT =
SIZE=3D3D2&gt;com.livesoftware.jsp.JSPServlet:&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT =
SIZE=3D3D2&gt;java.lang.NullPointerException: &lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT =
SIZE=3D3D2&gt;----------------------------------------------&lt;/FONT&gt=
;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;In the JSP page I =
have expressions like =3D</FONT>
<BR><FONT SIZE=3D2>&amp;lt;%=3D3Drequest.getAttribute(String, =
String)%&amp;gt;.&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;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>&amp;lt;%=3D3Drequest.getAttribute(String, =
String)%&amp;gt; in the JSP =3D</FONT>
<BR><FONT SIZE=3D2>page.&lt;/FONT&gt;&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;(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 &amp;lt;%=3D3Drequest.getParameter(String, =
String)%&amp;gt; )&lt;/FONT&gt;&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;I am using JRun 2.3.3 =
on Win NT 4.0 server.&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;Any idea what I am =
doing wrong ?&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;Thanks in advance for =
any pointers.&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;P&gt;&lt;FONT SIZE=3D3D2&gt;- Ramakrishnan =
Venkataraman&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;BR&gt;&lt;FONT SIZE=3D3D2&gt;&amp;nbsp; Email: =
[EMAIL PROTECTED]&lt;/FONT&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/P&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;/BODY&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/HTML&gt;</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.

Reply via email to