You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bi...@cci.com.tr on 2007/06/25 14:38:13 UTC

[S2] Cannot make XML Validation work for aliased action mapping

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 :

<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
      <field name="invoiceDate">
            <field-validator type="required">
                  <message>invoiceDate required!</message>
            </field-validator>
      </field>
      <field name="documentNumber">
            <field-validator type="requiredstring">
                  <message>documentNumber required!</message>
            </field-validator>
      </field>
</validators>

 struts.xml

<action name="Stockin_retrieveInvoice" class="Stockin"
                  method="retrieveInvoice">
                  <interceptor-ref name="scope">
                        <param name="session">documentDetail</param>
                        <param name="autoCreateSession">true</param>
                  </interceptor-ref>
                  <interceptor-ref name="webValidationStack"></interceptor-ref>
                  <result name="input">/WEB-INF/pages/jsp/stockin.jsp</result>
                  <result name="success">
                        /WEB-INF/pages/jsp/stockin.jsp
                  </result>
            </action>

bean -config in spring.xml

<bean name="Stockin"
            class="com.cci.fefo2.web.s2.Stockin" scope="prototype">
</bean>

and Stockin.java

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

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 Stockin extends ActionSupport{
      private DateFormat df = new SimpleDateFormat("ddMMyyyy");

      private String documentNumber;

      private Date invoiceDate;

      private List salesDetail;

      private List documentDetail;

      private StockInService stockInService;

      private ArticleMasterService articleMasterService;



      public String input() throws Exception {
            System.out.println("Stockin.input()");
            invoiceDate = df.parse("02052007");
            documentNumber = "01F28826842";
            documentDetail = null;
            salesDetail = null;
            return Action.INPUT;
      }
      public String forward() throws Exception{
            return Action.SUCCESS;
      }

      public String detail() throws Exception{
            return "detail";
      }

      public String cancel() throws Exception {
            documentDetail = null;
            return Action.INPUT;
      }

      public String retrieveInvoice() throws Exception {
            System.out.println("Stockin.retrieveInvoice()");
            documentDetail = stockInService.getInvoiceDetails("01", "3100007",
                        "2007", "05", documentNumber, invoiceDate);
            return Action.SUCCESS;
      }

      public String save() throws Exception {
            System.out.println("Stockin.doSave()");
            //TODO save stock in to DB
            return Action.SUCCESS;
      }

      /*
       * (non-Javadoc)
       *
       * @see com.opensymphony.xwork2.ActionSupport#execute()
       */
      public String execute() throws Exception {
            System.out.println("Stockin.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 documentNumber.
       */
      public String getDocumentNumber() {
            return documentNumber;
      }

      /**
       * @param documentNumber
       *            The documentNumber to set.
       */
      public void setDocumentNumber(String documentNumber) {
            this.documentNumber = documentNumber;
      }


      /**
       * @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 salesDetail.
       */
      public List getSalesDetail() {
            return salesDetail;
      }
      /**
       * @param salesDetail The salesDetail to set.
       */
      public void setSalesDetail(List salesDetail) {
            this.salesDetail = salesDetail;
      }
      /**
       * @return Returns the invoiceDate.
       */
      public Date getInvoiceDate() {
            return invoiceDate;
      }
      /**
       * @param invoiceDate The invoiceDate to set.
       */
      public void setInvoiceDate(Date stockInDate) {
            this.invoiceDate = stockInDate;
      }
      /**
       * @return Returns the articleMasterService.
       */
      public ArticleMasterService getArticleMasterService() {
            return articleMasterService;
      }
      /**
       * @param articleMasterService The articleMasterService to set.
       */
      public void setArticleMasterService(
                  ArticleMasterService articleMasterService) {
            this.articleMasterService = articleMasterService;
      }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Cannot make XML Validation work for aliased action mapping

Posted by Bi...@cci.com.tr.
I found out the problem. I missed the note at the documentation about validation
interceptor .

For those who may have the problem at past or in future,

Note that this has nothing to do with the com.opensymphony.xwork2.Validateable interface
and simply adds error messages to the action. The workflow of the action request does not
change due to this interceptor. Rather, this interceptor is often used in conjuction with
the workflow interceptor.


Sorry for inconvenience,
Birkan



                                                                                          
             Birkan_Duman@cci.com.tr                                                      
                                                                                          
             06/25/2007 05:02 PM                                                       To 
                                             "Struts Users Mailing List"                  
                                             <us...@struts.apache.org>                     
                Please respond to                                                      cc 
              "Struts Users Mailing                                                       
                      List"                                                       Subject 
             <user@struts.apache.org         Re: [S2] Cannot make XML Validation work for 
                        >                    aliased action mapping                       
                                                                                          
                                                                                          
                                                                                          
                                                                                          
                                                                                          
                                                                                          




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
             <ne...@yahoo.com>
                                                                                       To
             06/25/2007 03:51 PM             Struts Users Mailing List
                                             <us...@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
                        >









--- Birkan_Duman@cci.com.tr 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Cannot make XML Validation work for aliased action mapping

Posted by Bi...@cci.com.tr.
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                                                                  
             <ne...@yahoo.com>                                                      
                                                                                       To 
             06/25/2007 03:51 PM             Struts Users Mailing List                    
                                             <us...@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                       
                        >                                                                 
                                                                                          
                                                                                          
                                                                                          
                                                                                          
                                                                                          




--- Birkan_Duman@cci.com.tr 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] Cannot make XML Validation work for aliased action mapping

Posted by Dave Newton <ne...@yahoo.com>.
--- Birkan_Duman@cci.com.tr 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org