Then you'd probably want to use @DontBind rather than @DontValidate
(see http://mc4j.org/jira/browse/STS-288).

On Thu, May 29, 2008 at 11:38 AM, SivaKumarl
<[EMAIL PROTECTED]> wrote:
>
> Hi Friends,
>     I have a field with int datatype in action,while i submitting form with
> the string value its validating correctly,but when i invoking another
> event(ex:cancel) with string data then also the datatype is validating.But
> what i want is i have stop data validation when cancel event occurs.
>
> My Action class is:
>
> package net.ycs.stripes.examples.action;
>
> import org.apache.commons.beanutils.converters.IntegerConverter;
> import org.apache.commons.logging.LogFactory;
>
> import net.sourceforge.stripes.action.ActionBean;
> import net.sourceforge.stripes.action.ActionBeanContext;
> import net.sourceforge.stripes.action.DontValidate;
> import net.sourceforge.stripes.action.ForwardResolution;
> import net.sourceforge.stripes.action.HandlesEvent;
> import net.sourceforge.stripes.action.Resolution;
> import net.sourceforge.stripes.action.SimpleMessage;
> import net.sourceforge.stripes.action.UrlBinding;
> import net.sourceforge.stripes.util.Log;
> import net.sourceforge.stripes.validation.IntegerTypeConverter;
> import net.sourceforge.stripes.validation.Validate;
>
> //@UrlBinding("/Test1.action")
> public class Test1ActionBean implements ActionBean{
>
>        private static final Log LOG=Log.getInstance(Test1ActionBean.class);
>
>        ActionBeanContext context=null;
>
>        @Validate(on="submitDetails",required=true)
>        private String firstName;
>
>
> @Validate(on="submitDetails",required=true,converter=IntegerTypeConverter.class)
>        private Integer  amount;
>
>
>        public ActionBeanContext getContext() {
>                return context;
>        }
>        public void setContext(ActionBeanContext context) {
>                this.context = context;
>        }
>
>
>
>        public Integer getAmount() {
>                return amount;
>        }
>        public void setAmount(Integer amount) {
>                this.amount = amount;
>        }
>        public String getFirstName() {
>                return firstName;
>        }
>
>        public void setFirstName(String firstName) {
>                this.firstName = firstName;
>        }
>
>
>        public Resolution submitDetails()
>        {
>                LOG.debug("Inside SubmitDetails");
>                getContext().getMessages().add(new SimpleMessage("Submitted
> successfully"));
>                return new ForwardResolution("/testHandleEvent.jsp");
>        }
>
>
>        @DontValidate
>        public Resolution cancelDetails()
>        {
>                LOG.debug("Inside CancelDetails");
>                getContext().getMessages().add(new SimpleMessage("Canceled
> successfully"));
>                return new ForwardResolution("/testHandleEvent.jsp");
>        }
>
> }
>
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> My Jsp page is:
>
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
>    pageEncoding="ISO-8859-1"%>
>  <%@ taglib prefix="stripes"
> uri="http://stripes.sourceforge.net/stripes.tld"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd";>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> <title>Insert title here</title>
> </head>
> <body>
> <stripes:form action="/Test1.action">
> <stripes:errors/>
> <stripes:messages/>
> Name:<stripes:text name="firstName"/>
> Amount:<stripes:text name="amount"/>
>
> <stripes:submit name="submitDetails" value="submit"/>
> <stripes:submit name="cancelDetails" value="cancel"/>
> </stripes:form>
> </body>
> </html>
>
>
> Cheers
> -------
> Siva
>
>
>
>
> --
> View this message in context: 
> http://www.nabble.com/How-to-stop-the-validation-of-a-Datatype-for-particular-event-tp17531064p17531064.html
> Sent from the stripes-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to