Dear All, I have a form which is master-detail type containing customer information as master and also warehouse information as detail. For one customer it may contain more than one warehouse.
The Customer model class is as follows: package model; : : public class Customer { Integer id; String name; String address; String phone; String fax; : : Set<model.Warehouse> warehouses; : : When this form is loaded, it run action.Customer class which loads customer property inside. package action; import java.text.SimpleDateFormat; import java.util.*; import javax.servlet.ServletContext; import net.sf.jasperreports.engine.JasperCompileManager; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.Preparable; @SuppressWarnings("serial") public class Customer extends ActionSupport implements Preparable{ boolean ok; boolean cancel; boolean save; boolean copy; boolean print; service.Customer serviceCustomer; service.Warehouse serviceWarehouse; model.Customer customer; action.Warehouses actionWarehouses; : : public String execute() throws Exception { : : if(customer==null) { customer=(model.Customer)ActionContext.getContext().getSession().get("customer"); customer=serviceCustomer.get(customer.getId()); } else { ActionContext.getContext().getSession().put("customer",customer); } : : I also have Customer-validation.xml for this action: <?xml version="1.0" encoding="GBK"?> <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> <validators> <field name="customer.name"> <field-validator type="requiredstring"> true <message key="name.required" /> </field-validator> <field-validator type="stringlength"> 4 50 true <message key="name.length" /> </field-validator> </field> : : When the form is submitted but validation fails, it is directed to the page with result="input" in struts.xml which maps to my JSP form again. However, warehouse information is lost. I know why the information is lost as it is not inside form fields. So I want to ask this master-detail situation which I think is a quite general case, normally how should we handle it with presence of validation xml? Or I should do the validation in action class without using struts validation xml? I prefer to use the first method as it is more robust, but if it is impossible I would adopt to use the second one. Please advise! Thanks! Terry. -- View this message in context: http://old.nabble.com/Master-details-JSP-with-Validation-xml-tp29940574p29940574.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org