Hi All, After a couple of days I can't seem to figure this validation problem out. I have a basic JSP form (create.jsp) with a textfield (with validation) and a select list (WITHOUT validation). When I submit the form to trigger a validation failure on purpose, the text field is validated correctly and the user input is still present, however, the select list disappears below it and the following error is given:
ERROR [[default]] Servlet.service() for servlet default threw exception tag 'select', field 'list', name 'catID': The requested list key 'categories' could not be resolved as a collection/array/map/enumeration/it erator type. Example: people or people.{name} - [unknown location] I've read about similar problems and they say to initialize the collections in the prepare(). I did that and I'm still getting the problem. Another solution I've heard was to put the Collection in the session. This doesn't seem like a scalable solution for applications that are deployed in a session replicated enviornement like clustering. Please tell me that putting the list in the seseion isn't the only work around? ----------------------------------------------------------------------------------------------------------- Action Code: ------------------------------------------------------------------------------------------------------------ public class CreateTicket extends ActionSupport implements Preparable { private Map categories; public Map getCategories() { return categories; } public void setCategories(Map categories) { this.categories = categories; } public String execute() throws Exception { this.prepare(); return SUCCESS; } public void prepare() throws Exception { categories = new HashMap(); categories.put(1, "test"); categories.put(2, "test2"); categories.put(3, "test3"); } } public class HelloWorld extends ActionSupport { public static final String MESSAGE = "Struts is up and running ..."; private String name; private Integer catID; public Integer getCatID() { return catID; } public void setCatID(Integer catID) { this.catID = catID; } public String execute() throws Exception { setMessage(MESSAGE + " " + getName()); return SUCCESS; } private String message; public void setMessage(String message) { this.message = message; } public String getMessage() { return message; } public String getName() { return name; } public void setName(String name) { this.name = name; } ---------------------------------------------------------------------------------------------------------- /tutorial/create.jsp Code: ---------------------------------------------------------------------------------------------------------- <s:form action="HelloWorld"> <s:textfield name="name" label="Your name" size="50"/> <s:select name="catID" label="Categories" list="categories"/> <s:submit/> </s:form> ---------------------------------------------------------------------------------------------------------- struts.xml Code: ---------------------------------------------------------------------------------------------------------- <struts> <constant name="struts.action.extension" value="" /> <constant name="struts.devMode" value="true" /> <package name="default" extends="struts-default"> <action name="create" class="tutorial.CreateTicket"> <result>/ticket/create.jsp</result> </action> <action name="HelloWorld" class="tutorial.HelloWorld"> <result name="success">/ticket/createconfirm.jsp</result> <result name="input">/ticket/create.jsp</result> </action> </package> </struts> ---------------------------------------------------------------------------------------------------------- HelloWorld-validaiton.xml: ---------------------------------------------------------------------------------------------------------- <validators> <validator type="stringlength"> <param name="fieldName">name</param> <param name="minLength">10</param> <param name="maxLength">10</param> <param name="trim">true</param> <message>Your name needs to be 10 characters long</message> </validator> </validators>