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

LazyValidatorForm and Lazy DynaBean

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228

I am trying to display a dynamic JSP page.
Input fields(radio,select,textbox) on JSP page are displayed dynamically depending on the user actions on the JSP page.
for this I configured LazyValidatorForm for myForm in struts-config.xml.

struts-config.xml has
<form-bean name="myForm" type="org.apache.struts.validator.LazyValidatorForm"/>

in action class i am doing
DynaBean myForm = (DynaBean) form;

i know i can do this to get the values
String custNo = (String)myForm.get("blah");

but i cant do this becoz i shd have 1000's of such get methods.
Is there any other way to get the values from DynaBean.

Thanks in advance,
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Since the values are stored in a java.util.Map, you could get all the mapping entries using map.entrySet(). This produces a List whose elements are of type Map.Entry. You could then iterate through this list and get the values one by one.
[ March 01, 2006: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: LazyValidatorForm and Lazy DynaBean
It's not a secret anymore!