wood burning stoves 2.0*
The moose likes Struts and the fly likes Action Form Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Action Form Error" Watch "Action Form Error" New topic
Author

Action Form Error

Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi to all,

when i am trying to get from details in my action class i am getting this error

//use NameFrom to get the request parameters
NameForm nameForm = (NameForm)form;

Error Message:Cannot cast from ActionForm to NameForm
Please anybody tell me what's wrong in this line.

Regards,
vardhan
Praveen Kumar
Ranch Hand

Joined: Nov 06, 2006
Posts: 133
Which action form you are using like ActionForm or DynoActionForm.
If you user ActionForm, then

ActionForm xxx=(ActionForm)form;

if you are usinf DynoActioForm,
DynaActionForm inForm = (DynaActionForm) form;
Long IDId = (Long) inForm.get("Id");

This should help you.
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi kumar,
i am using ActionFrom only (not using dynaActionFrom).i done same but still i am getting that error.

Regards,
vardhan
Praveen Kumar
Ranch Hand

Joined: Nov 06, 2006
Posts: 133
Then paste your code here?

Action element of that class(action in config )and Action class also .

main snippet is enough.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

May be silly, but does your NameForm extends org.apache.struts.action.ActionForm?


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi,

Thanks to all for giving replay i got the place where i done mistake.

Regards,
vardhan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action Form Error
 
Similar Threads
problem in compiling Action class?
Error: Cannot retrieve mapping for action /Name
Href and sending the fileds through URL
New to Struts, where did I go wrong?
Element type "plug-in" must be declared.