File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Iterating ActionForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iterating ActionForm" Watch "Iterating ActionForm" New topic

Iterating ActionForm

Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
Hello All,

Is there any way I can get the list of fields & values dynamically from the ActionForm ?

Thanks much.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
You can create a sub-class of the ActionForm class and (1) create a method that returns a list of fields and values, or (2) override the toString() method and have it return a list of fields and values.

Create your application-specific ActionForms by having them extend this sub-class rather that the Struts class directly.
[ October 03, 2008: Message edited by: James Clark ]
Makeshkumar Subramaniam

Joined: Aug 09, 2008
Posts: 21

You can get an class/object 's fields and methods using java's Reflection API with google about reflection api java........learn it and do it..enjoy.;-)


[URLyBird1.1.1 - > just started]
I agree. Here's the link:
subject: Iterating ActionForm
It's not a secret anymore!