Hi Dave, Thank you very much for your help,
You're right, obviously my fault. I renamed the validation file to Stockin-Stockin_retrieveInvoice-validation.xml and it works now. Unfortunately, I have a new issue, I have another validation.xml that started to work now with the same correction you supplied in my config. When I submit the form, interceptor intercepts the action method and displays the errors, But the remaining interceptors continue to process the request (e.g scope interceptor), and action method save() is also called and inserts the record to the list , instead of interrupting the remaining process. I'm new to interceptors but nearly everything in place in the configuration and really cannot point out the problem. Any idea? Here again my corresp. config: UpdateStockinDetail-UpdateStockinDetail_save-validation.xml <!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> <validators> <field name="movement.units"> <field-validator type="required"> <message>movement.prodDate required!</message> </field-validator> </field> <field name="movement.prodDate"> <field-validator type="required"> <message>movement.prodDate required!</message> </field-validator> </field> <field name="movement.stockPlace"> <field-validator type="required"> <message>movement.stockPlace required!</message> </field-validator> </field> </validators> updatestockindetails.jsp <s:form method="POST" namespace="secure"> <s:hidden name="invoiceViewIndex"></s:hidden> <s:textfield required="true" label="movement.units" name="movement.units"></s:textfield> <s:datetimepicker label="movement.prodDate" name="movement.prodDate" displayFormat="dd.MM.yyyy" displayWeeks="5" required="true" /> <s:textfield required="true" label="movement.stockPlace" name="movement.stockPlace"></s:textfield> <s:submit value="Submit" action="UpdateStockinDetail_save"></s:submit> </s:form> action-mapping <action name="UpdateStockinDetail_save" class="UpdateStockinDetail" method="save"> <interceptor-ref name="scope"> <param name="session"> documentDetail,movementList,invoiceView,invoiceViewIndex </param> <param name="autoCreateSession">true</param> </interceptor-ref> <interceptor-ref name="webValidationStack"></interceptor-ref> <result name="input"> /WEB-INF/pages/jsp/updatestockindetail.jsp </result> <result name="success"> /WEB-INF/pages/jsp/updatestockindetail.jsp </result> </action> interceptor definition <interceptors> <interceptor-stack name="webStack"> <interceptor-ref name="exception" /> <interceptor-ref name="alias" /> <interceptor-ref name="servletConfig" /> <interceptor-ref name="prepare" /> <interceptor-ref name="i18n" /> <interceptor-ref name="chain" /> <interceptor-ref name="debugging" /> <interceptor-ref name="profiling" /> <interceptor-ref name="checkbox" /> <interceptor-ref name="staticParams" /> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*</param> </interceptor-ref> <interceptor-ref name="conversionError" /> </interceptor-stack> <interceptor-stack name="webValidationStack"> <interceptor-ref name="webStack" /> <interceptor-ref name="validation"> <param name="excludeMethods"> input,back,cancel,browse </param> </interceptor-ref> </interceptor-stack> </interceptors> <default-interceptor-ref name="webStack" /> and finally the action import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.commons.collections.CollectionUtils; import org.apache.struts2.interceptor.ParameterAware; import com.cci.fefo2.db.beans.Movement; import com.cci.fefo2.db.beans.view.InvoiceView; import com.cci.fefo2.service.ArticleMasterService; import com.cci.fefo2.service.StockInService; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionSupport; /** * @author bduman * * TODO To change the template for this generated type comment go to Window - * Preferences - Java - Code Style - Code Templates */ public class UpdateStockinDetail extends ActionSupport implements ParameterAware{ private Map parameters; private DateFormat df = new SimpleDateFormat("ddMMyyyy"); private List documentDetail; private InvoiceView invoiceView; private Movement movement; private List movementList; private String invoiceViewIndex; private StockInService stockInService; private ArticleMasterService articleMasterService; public String input() throws Exception { System.out.println("UpdateStockinDetail.input()"); String[] obj = (String[]) parameters.get("id"); String index = obj[0]; System.out.println(obj[0]); invoiceViewIndex = index; invoiceView =(InvoiceView) documentDetail.get(Integer.parseInt(invoiceViewIndex)); movementList = new ArrayList(); CollectionUtils.addAll(movementList, invoiceView.getMovements().toArray());//try to clone return Action.INPUT; } public String removeMovement() throws Exception { System.out.println("UpdateStockinDetail.removeMovement()"); String[] obj = (String[]) parameters.get("index"); String index = obj[0]; System.out.println(index); movementList.remove(Integer.parseInt(index)); return Action.INPUT; } public String cancel() throws Exception { return Action.SUCCESS; } public String save() throws Exception { System.out.println("UpdateStockinDetail.save()"); movementList.add(movement); return Action.INPUT; } public String saveStockinMovements() throws Exception { System.out.println("UpdateStockinDetail.save()"); invoiceView.setMovements(movementList); return Action.SUCCESS; } /* * (non-Javadoc) * * @see com.opensymphony.xwork2.ActionSupport#execute() */ public String execute() throws Exception { System.out.println("UpdateStockinDetail.execute()"); return super.execute(); } /** * @return Returns the documentDetail. */ public List getDocumentDetail() { return documentDetail; } /** * @param documentDetail * The documentDetail to set. */ public void setDocumentDetail(List documentDetail) { this.documentDetail = documentDetail; } /** * @return Returns the stockInService. */ public StockInService getStockInService() { return stockInService; } /** * @param stockInService * The stockInService to set. */ public void setStockInService(StockInService stockInService) { this.stockInService = stockInService; } /** * @return Returns the articleMasterService. */ public ArticleMasterService getArticleMasterService() { return articleMasterService; } /** * @param articleMasterService * The articleMasterService to set. */ public void setArticleMasterService( ArticleMasterService articleMasterService) { this.articleMasterService = articleMasterService; } /* * (non-Javadoc) * * @see org.apache.struts2.interceptor.ParameterAware#setParameters(java.util.Map) */ public void setParameters(Map arg0) { this.parameters = arg0; } /** * @return Returns the invoiceViewIndex. */ public String getInvoiceViewIndex() { return invoiceViewIndex; } /** * @param invoiceViewIndex The invoiceViewIndex to set. */ public void setInvoiceViewIndex(String invoiceViewIndex) { this.invoiceViewIndex = invoiceViewIndex; } /** * @return Returns the invoiceView. */ public InvoiceView getInvoiceView() { return invoiceView; } /** * @param invoiceView The invoiceView to set. */ public void setInvoiceView(InvoiceView invoiceView) { this.invoiceView = invoiceView; } /** * @return Returns the movement. */ public Movement getMovement() { return movement; } /** * @param movement The movement to set. */ public void setMovement(Movement movement) { this.movement = movement; } /** * @return Returns the movementList. */ public List getMovementList() { return movementList; } /** * @param movementList The movementList to set. */ public void setMovementList(List movementList) { this.movementList = movementList; } } Dave Newton <[EMAIL PROTECTED]> To 06/25/2007 03:51 PM Struts Users Mailing List <user@struts.apache.org> cc Please respond to "Struts Users Mailing Subject List" Re: [S2] Cannot make XML Validation work for <user@struts.apache.org aliased action mapping > --- [EMAIL PROTECTED] wrote: > Hi, > > I'm using > > struts-core-2.0.8 j4 distribution, > struts2-spring-plugin-j4-2.0.6, > and corresponding j4 distribution jars, > > > I have an action with several methods. I use each > method as an action mapping and I want > to use different validation.xml files for each > action mapping. > > In the documentation, AFAIU, it says that using the > [actionname]_[methodname]-validation.xml in the same > package with the action class should > work to accomplish this type of validation. But I > could't succeed to make the validation > work. > > Anybody has an idea? Thanks for any replies. > > My configuration follows: > > stockin.jsp > > <s:form method="POST" namespace="secure"> > <s:if test="%{documentDetail == null || > documentDetail.size == 0}"> > <s:textfield label="documentNumber" > required="true" > name="documentNumber" /> > <s:datetimepicker required="true" > label="invoiceDate" displayWeeks="5" > name="invoiceDate" > displayFormat="dd.MM.yyyy" /> > <s:submit label="Retrieve Invoice" > value="Retrieve Invoice" > action="Stockin_retrieveInvoice" > /> > </s:if> > <s:actionerror label="errors" /> > </s:form> > > Stockin_retrieveInvoice-validation.xml : Is that a typo? While this is still a bit unclear to me (and I think wrong), you may need to name the XML file something like: Stockin-Stockin_retrieveInvoice-validation.xml. The "alias" filename component may want the name of the action (<action.../>'s "name" attribute value). d. ____________________________________________________________________________________ Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]