struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anjib Mulepati <anji...@hotmail.com>
Subject Re: Clear up concept of validation() call
Date Thu, 18 Nov 2010 16:20:24 GMT
Thanks Pawel

That was the problem. I have validate="false". don't know why I did 
that? :)
And I guess default value is true for this right?

Thanks again
Anjib

On 11/18/2010 11:02 AM, Paweł Wielgus wrote:
> Hi Anjib,
> have You set validate=true in struts-config.xml for this action like below?
>
> <  action path="/path/to/action"	
> type="com.UploadAction"
> name="myTestForm"
> input="tile.definition"
> validate="true">
>
> Best greetings,
> Paweł Wielgus.
>
>
> 2010/11/18 Anjib Mulepati<anjibcs@hotmail.com>:
>> Hi everyone
>>
>> I got confuse with the call of ActionForm in Struts 1.3.8
>>
>> If I have Form as follow with validate() method
>>
>> public class MyTestForm extends org.apache.struts.action.ActionForm {
>>
>>      String myTestString;
>>
>>     public MyTestForm() {
>>         super();
>>     }
>>
>>     public String getMyTestString() {
>>         return myTestString;
>>     }
>>
>>     public void setMyTestString(String newString) {
>>         this.myTestString =newString;
>>     }
>>
>>     @Override
>>     public ActionErrors validate(ActionMapping mapping, HttpServletRequest
>> request) {
>>         ActionErrors errors = new ActionErrors();
>>         //do validation of myTestString
>>         return errors;
>>    }
>>
>> }
>>
>> And I have Action class as
>>
>> public class UploadAction extends org.apache.struts.action.Action {
>>
>>     public ActionForward execute(ActionMapping mapping, ActionForm form,
>>             HttpServletRequest request, HttpServletResponse response)
>>             throws IOException, ServletException {
>>                         MyTestForm myForm = (MyTestForm) form;
>>                         //Other operation
>>    }
>> }
>>
>> Now when I debug with debugging point at both validate() and execute()
>> method's first statement what i found is the control never goes to
>> validate() method. I was guessing control should go to validate method first
>> then only to execute method. In other word my input was never validated.
>>
>> What I am doing wrong? Can anyone help me out in this?
>>
>> Thanks in advance
>> Anjib
>>
>>
>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message