This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Struts and the fly likes LazyValidatorForm and Lazy DynaBean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "LazyValidatorForm and Lazy DynaBean " Watch "LazyValidatorForm and Lazy DynaBean " New topic
Author

LazyValidatorForm and Lazy DynaBean

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Hi,

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-beans>
<form-bean name="myForm" type="org.apache.struts.validator.LazyValidatorForm"/>
</form-beans>

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 ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: LazyValidatorForm and Lazy DynaBean
 
Similar Threads
How I can edit 'java.util.Set' DynaValidatorForm form-property
lazy action form problem
Struts:FormBean issue with html:select tag
how to obtain list object from an actionform
LazyValidatorForm