struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Lowe" <mel...@gmail.com>
Subject Re: Validation Problem
Date Wed, 22 Mar 2006 14:41:24 GMT
validate="true" just means that the validate(mapping,req) method will
be called and forwarded back to the inputForward before you get to the
action. But as you call it in the action this shouldn't matter..

Are things going wrong in the validate method (i.e. does errors.size()
return zero even when its an invalid usecase) or is the problem
between saveErrors(..) and the jsp?

Sorry I have no idea what's wrong either, but might help to know which
part isn't working..

Mark

On 3/22/06, Thibaut <lasthib@ifrance.com> wrote:
> Thank you for your quick reply !
> I really don't know what is the difference between what i do and the
> "struts-mailreader" exemple !!!!
>
> I already did what you write here. In fact it was the first think i did.
> I have this problem for *all my actions* in my app.
>
> So the code is :
>
>
>     <action    path="/insertANewCandidate"
>
> type="com.cvdunet.controller.action.UpdateResponsesForRequestAction"
>                input="missions_copyMailToBasket.jsp"
>                name="candidateForm"
>                scope="request"
>                validate="true">
>        <forward name="success_from_tool" path="/close.jsp"/>
>        <forward name="success" path="/mycv.jsp"/>
>     </action>
> ...
>   <controller pagePattern="$M$P" maxFileSize="2M" inputForward="true" />
>   <message-resources
> parameter="com.cvdunet.controller.ApplicationResources"/>
>
>
> In the bean :
>
>      public ActionErrors validate(ActionMapping mapping,
> HttpServletRequest request)
>      {
>          ActionErrors errors  = new ActionErrors();
>          ActionMessage error = new
> ActionMessage("com.cvdunet.response.NOBASKETSELECTED");
>          errors.add(ActionMessages.GLOBAL_MESSAGE, error);
>           return errors;
>     }
>
>
> In the ApplicationResources.properties
>
> com.cvdunet.response.NOBASKETSELECTED = No basket selected
>
>
> In the missions_copyMailToBasket.jsp :
>
> ...
> <html:errors/>
> ...
>
>
>
>
>
>
> What's wrong ?
>
>
>
> hermod.opstvedt@dnbnor.no a écrit :
>
> >Hi
> >
> >Howecome you have validate="false"? If you want validation, then set it to true
> >
> >
> >-----Original Message-----
> >From: Thibaut [mailto:lasthib@ifrance.com]
> >Sent: Wednesday, March 22, 2006 11:41 AM
> >To: user@struts.apache.org
> >Subject: Validation Problem
> >
> >
> >Hi
> >
> >I have all the time the same problem and there is a week i try to solve
> >it. It should be trivial but i can't see.
> >None of my validation work !
> >I now use Struts 1.2.8 with module. The application use to work with
> >Struts 1.0.
> >
> >In the Struts-config.xml of the "user" module :
> >
> >    <action    path="/insertANewCandidate"
> >
> >type="com.cvdunet.controller.action.UpdateResponsesForRequestAction"
> >               input="missions_copyMailToBasket.jsp"
> >               name="candidateForm"
> >               scope="request"
> >               validate="false">
> >       <forward name="success_from_tool" path="/close.jsp"/>
> >       <forward name="success" path="/mycv.jsp"/>
> >    </action>
> >...
> >
> >  <controller pagePattern="$M$P" maxFileSize="2M" inputForward="true" />
> >  <message-resources
> >parameter="com.cvdunet.controller.ApplicationResources"/>
> >
> >
> >
> >In the action :
> >
> >        CandidateForm candidateForm = (CandidateForm) form;
> >            ActionMessages errors = candidateForm.validate();
> >            if (!errors.isEmpty()) {
> >                this.saveErrors(request, errors);
> >                return mapping.getInputForward();
> >            }
> >
> >
> >
> >And in the form :
> >
> >     public ActionMessages validate()
> >     {
> >             ActionMessages errors  = new ActionMessages();
> >             ActionMessage error = new
> >ActionMessage(CandidateConstant.NO_BASKET);
> >             errors.add(ActionMessages.GLOBAL_MESSAGE, error);
> >             return errors;
> >    }
> >
> >
> >Can anyone help ?
> >Thank you
> >
> >--
> >Thibaut Lassalle
> >
> >
> >
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message