File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.ClassCastException

 
Harish Maridi
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Harish Maridi
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou very much Merrill...

Awesome java ranch....
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic