You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tarun Ramakrishna Elankath <ta...@webkadai.com> on 2003/05/02 19:00:49 UTC

Re: java.lang.ClassCastException problem when updating to tomcat 4.1

Try cleaning the classes directory (or your expanded WAR) and
re-compiling again.

On Fri, 2003-05-02 at 14:45, Christophe Andreoli wrote:
> Hi Rosdi,
> 
> I have to initialize my Bean in a Struts action class.
> 
> But anyway it is not the problem and it worked with tomcat 4.0
> 
> 
> 
> 
> 
> 
> 
> Rosdi bin Kasim wrote:
> > 
> > I am not very clear about what you intend to do.
> > Why did you save your bean that way?.. Why didn't you initialize your bean
> > in JSP like this..
> > 
> > -- JSP 1 --
> > 
> > <jsp:useBean id="roleBean" scope="session"
> > class="com.ihg.mitop.gui.RoleBean"/>
> > 
> > <%
> >     // set whatever attribute you want to set in the bean
> >     roleBean.setHolgerUser(1);
> >     roleBean.setXXX(yyy);
> > 
> > %>
> > 
> > Then read the bean from another JSP...
> > 
> > -- JSP 2 --
> > 
> > <jsp:useBean id="roleBean" scope="session"
> > class="com.ihg.mitop.gui.RoleBean"/>
> > 
> > <%
> > 
> >     // get whatever attribute you want to get...
> >     if (roleBean.getHolgerUser() == 1 ) {
> >         //do something..
> >     }
> > 
> > %>
> > 
> > Regards,
> > Rosdi.
> > 
> > ----- Original Message -----
> > From: "Christophe Andreoli" <an...@gsf.de>
> > To: <to...@jakarta.apache.org>
> > Sent: Friday, May 02, 2003 4:45 PM
> > Subject: java.lang.ClassCastException problem when updating to tomcat 4.1
> > 
> > > there was no problem with tomcat 4.0 but  with updating to 4.1 , I get
> > > the following problem:
> > >
> > >
> > >  I instantiate in my action class a role bean and save it to the session
> > > with the following code:
> > >
> > > RoleBean role = new RoleBean();
> > > request.getSession().setAttribute("roleBean", role);
> > >
> > >
> > > But then in the jsp pages using the role bean, as:
> > >
> > > <jsp:useBean id="roleBean" scope="session"
> > > class="com.ihg.mitop.gui.RoleBean"/>
> > >
> > > <% if (((RoleBean)roleBean).getHolgerUser() == 1 ){ %> etc .....
> > >
> > >
> > >
> > > I get the following exception:
> > >
> > > java.lang.ClassCastException: com.ihg.mitop.gui.RoleBean
> > >
> > > ??
> > >
> > >
> > > Can you help ?
> > >
> > >
> > >  thank you
> > >
> > 
> > ----------------------------------------------------------------------------
> > ----
> > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> ______________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org