Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Retrieving a list for a dynavalidator form

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am using dynavalidator form in which the type for one of the form-
property is list. For eg
<form-bean name="ABCForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="statelistString" type="java.lang.String"></form-
property>
<form-property name="statelist"
type="java.util.List" ></form-property>
</form-bean>
I am populating the list in the reset method for the default values
like
List test = new ArrayList();
test.add(0,someVO1);
test.add(1,someVO2);
session.setAttribute("list",test);
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"/>
</html:select>

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 !!!
Regards
 
    Bookmark Topic Watch Topic
  • New Topic