aspose file tools*
The moose likes Struts and the fly likes java.lang.ClassCastException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "java.lang.ClassCastException" Watch "java.lang.ClassCastException" New topic
Author

java.lang.ClassCastException

Harish Maridi
Ranch Hand

Joined: May 20, 2008
Posts: 60
I have a struts form, I assaigned styleId to it.
and I wrote a java script as follows.

function redirectPageTo(tiknum) {
var name = document.getElementById('ApproveForm');
name.tiknum.value = tiknum;
name.submit();
}
It is sumitting the form. But I am getting java.lang.ClassCastException.
java.lang.ClassCastException: com.att.struts.Approvelist.ApprovelistForm
com.att.struts.Approvelist.ApprovelistAction.execute(ApprovelistAction.java:18)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


I am getting from the root cause that the exception is from the action class. But why it is coming and Suggest me any solution for that.

Thankyou.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This problem is caused by the fact that the ActionForm you're actually receiving as a parameter to the execute method in your Action class is different than the one you are expecting. Look closely at the action mapping you defined for this action in the struts-config.xml file and make sure that the ActionForm class you defined for it matches the one you coded in the Action class.


Merrill
Consultant, Sima Solutions
Harish Maridi
Ranch Hand

Joined: May 20, 2008
Posts: 60
Thankyou very much Merrill...

Awesome java ranch....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.ClassCastException