Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Action Form Error

 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be silly, but does your NameForm extends org.apache.struts.action.ActionForm?
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Regards,
vardhan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic