Meaningless Drivel is fun!*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iterating ActionForm" Watch "Iterating ActionForm" New topic
Author

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
Greenhorn

Joined: Aug 09, 2008
Posts: 21

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


cheers,
Makesh.

[URLyBird1.1.1 - > just started]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Iterating ActionForm
 
Similar Threads
what is formbean in struts?
the 2 application i am doing , need help -kenji from tokyo
BeanUtils.populate error
Is ActionForm is part of controller or view
How to Highlight (select) all elements of a "multiple select" when the page loads?