This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Struts and the fly likes Retrieving a list for a dynavalidator form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Retrieving a list for a dynavalidator form" Watch "Retrieving a list for a dynavalidator form" New topic

Retrieving a list for a dynavalidator form

Balbir Singh
Ranch Hand

Joined: Jun 01, 2001
Posts: 79
I am using dynavalidator form in which the type for one of the form-
property is list. For eg
<form-bean name="ABCForm"
<form-property name="statelistString" type="java.lang.String"></form-
<form-property name="statelist"
type="java.util.List" ></form-property>
I am populating the list in the reset method for the default values
List test = new ArrayList();
someVO is a ValueObject which has got a String attribute name, so
basically in my reset method i create 2 objects of someVO with
different names.
and in the jsp, i am retrieving the list like this
<html:select name="ABCForm" property="stateListString" size="1">
<html ptions
collection="list" property="name"/>

This works fine, but there are two problems in this :
1) I have to create a VO for every string to be displayed in the List
2)I have to explicitly put the list in the session.
There must be a better solution to this, since if a type is declared
as list in the DynaValidatorForm and the form is available in the
session, then i need not put the list back in the session again.
Please help !!!

Thanks and Regards<br />Balbir Singh<br />Sun Certified Java Programmer<br />IBM Certified Administrator for WebSphere4.0
It is sorta covered in the JavaRanch Style Guide.
subject: Retrieving a list for a dynavalidator form
It's not a secret anymore!