You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tushar Kharbanda <tu...@yahoo.co.in> on 2004/06/03 08:45:13 UTC
< layout:optionsDependent > problem!!
In the code below what would be my ActionForm class,
and what all attributes will it have and of which type,
do we need a City class too..
I am gettin an error HTML BEAN tag not found... so i
guess some prroblem with the jsp/form....
<layout:select key="Country" property="country" styleClass="FIELD"> <layout:option value=""/> <layout:options collection="countries" property="name" sourceOf="city"/></layout:select> <layout:select key="City" property="city" styleClass="FIELD"> <layout:optionsDependent collection="cities" dependsFrom="country"/></layout:select>
The model object is as follow:
public class Country { private String name; private List cities = new ArrayList(); public Country(String in_name) { name = in_name; } public String getName() { return name; } public List getCities() { return cities; } public void addCity(String in_city) { cities.add(in_city); }}
A list of Country object is put directly in the request scope under the key "countries".
The Struts form has 2 properties country and city.
Yahoo! India Matrimony: Find your partner online.