tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leon Palermo" <le...@zedak.com>
Subject Re: Can not retrieve Object stored from servlet into session
Date Tue, 17 Oct 2000 11:50:40 GMT
Hey Werner,

You still have to import the file in the JSP to find User even if it is in
the classes folder.  The reason is that when the .jsp file is compiled into
a .class servlet file; the imports of the page tag are used to create import
statements in the Java file.  If you dont import the User class it is never
explicitly imported in the actual servlet code.  So do this at the beginning
of the .jsp file:

<%@ page session="true" import="<package>.User"%>

Hope this helps!

Leon


> Hi,
>
> I'm using RH6.2, jdk1.2.2, Apache 1.3.14, Tomcat 3.2 Beta6
>
> In my servlet i'm storing a User object into a session :
>
> HttpSession session = request.getSession(true);
> User user = new User(userid, password);
> session.setAttribute("user", user);
>
> This servlet compiles without a problem and the User.class is stored
> in the $(TOMCAT_HOME)/webapps/test/WEB-INF/classes folder
> so that the servlet can find it.
>
> In my JSP i do the following :
>
> <jsp:usebean Class="User" id="user" scope=session"/>
>
> But when i try to retrieve the JSP i get the following error :
>
> org.apache.jasper.JasperException: Unable to compile
> class for
>
JSP/usr/local/tomcat/work/localhost_8080%2Fgedas/_0002fjsp_0002fmenu_0002ejs
pmenu_jsp_0.java:61:
>
> Class jsp.User not found.
>                  User user =
> (User)session.getAttribute("user");
>                  ^
>
/usr/local/tomcat/work/localhost_8080%2Fgedas/_0002fjsp_0002fmenu_0002ejspme
nu_jsp_0.java:61:
>
> Class jsp.User not found.
>                  User user = (User)session.getAttribute("user");
>
> Am i doing something wrong ?
> Or is this a bug ?
> Any can help me on this ?
>
> Thanks
>
> Werner Ramaekers
>
>
>


Mime
View raw message