This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[jsp] classcast excetion

 
wessel zaalberg
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I did was connet a bean I just filled with date to an attribute in the servelt context.
if (hasData)
{ contekst.setAttribute("db_data", naw);
return new ActionRouter("naw-gegevens-page");
}
in the jsp file I have :
<%
ServletContextapp = getServletConfig().getServletContext();
NawGegevens naw = (NawGegevens) app.getAttribute("db_data");
%>
This gives the result ClassCastException.
THe class NawGegevens in in the package beans , in the directory class/beans and that is how the calling class NawGegevensAction can find it.
I am not sure if this path is in the classpath of tomcat, nor would I know how to make this class known.
 
wessel zaalberg
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the solution, it didnot know the type of class so with
<%@ page import="beans.NawGegevens" %>
it is made known.
<%
ServletContextapp = getServletConfig().getServletContext();
NawGegevens naw = (NawGegevens) app.getAttribute("db_data");
%>
I stil prefer a more generic solution, but I 'm glad this works, I get the previously filled data.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic