This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "java.lang.ClassCastException" Watch "java.lang.ClassCastException" New topic


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;
It is sumitting the form. But I am getting java.lang.ClassCastException.
java.lang.ClassCastException: com.att.struts.Approvelist.ApprovelistForm

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.

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.

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:
subject: java.lang.ClassCastException
jQuery in Action, 3rd edition