tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Williamson <Mark.William...@Appropria.com>
Subject RE: A bit of an odd one
Date Thu, 01 Jun 2000 13:01:51 GMT

Hmm,

I fixed it by putting the object into the page context.
This still doesn't tell me why I should have this problem 
though..... 

anyone shed any light on it?

mark



-----Original Message-----
From: Mark Williamson [mailto:Mark.Williamson@Appropria.com]
Sent: 01 June 2000 13:01
To: 'tomcat-user@jakarta.apache.org'
Subject: A bit of an odd one


Hi,

A bit of an odd one this. Essentially we have a servlet 
that contains the following bit of code:

 Assembler assembler = new Assembler();
 req.setAttribute("Assembler", assembler);
 // get request dispatcher from servlet context
  RequestDispatcher requestDispatcher =
servletContext.getRequestDispatcher(template);
 // forward the request
  requestDispatcher.forward(req, res);

And in the jsp code (pointed to by template)
we have this :

<%
 obj = request.getAttribute("Assembler");
 if ( obj != null )
 {
	System.out.println( obj.getClass() );		// debugging stuff
	Assembler pageAssembler = (Assembler) obj;
}
%>

What happens is that obj is indeed not null. The class comes 
out exactly as expected and then this error ensues: 

java.lang.ClassCastException: com.appropria.xtriffid.assembler.Assembler
	at
jsp._0002fjsp_0002fstandard_0002ejspstandard_jsp_42._jspService(_0002fjsp_00
02fstandard_0002ejspstandard_jsp_42.java:104)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	[snip]

this is the root cause of a servlet exception. 

Does anyone have any idea why this is happening?

cheers 

mark

--------------------------------------------------------------------------
To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org
For additional commmands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message