File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Problem with ActionForm 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 "Problem with ActionForm" Watch "Problem with ActionForm" New topic

Problem with ActionForm

Pramod Kumar
Ranch Hand

Joined: Oct 05, 2007
Posts: 40
I have a form bean class in a jar file and it is not extending ActionForm, Now I need to use that bean and need to write Action class to that. In struts-config.xml I have configured that bean and in Action class I wrote

User user = (User)form; and in eclipse it is showing error Cannot cast from ActionForm to User.

How can I solve this problem.
Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
You can't cast from an ActionForm to a bean or vo. You have to map the variables manually. Create a mapFormToXXXX method.
wood burning stoves
subject: Problem with ActionForm
It's not a secret anymore!