If you want validation like in struts1 you can implement the interface
com.opensymphony.xwork2.Validateable in your Action class. The method
validate() is the same as in your struts1 FormBean.

But maybe that's a bit old fashioned :)

Regards
-- 
Markus Stauffer

On Mon, Jul 14, 2008 at 8:54 AM, Jeromy Evans
<[EMAIL PROTECTED]> wrote:
> Nicole Luneburg wrote:
>>
>>
>>
>> <s:form action=3D"myaction" method=3D"post" validate=3D"true">
>>
>
> The validate attribute here is used to enable client-side validation only.
>  That will only work if you include the <s:head> attribute in the page.
>
>
>>
>>
>> My setup is that I have an Action class, which uses a Form to set and get
>> f= ield values from the JSP page.
>>
>> In Struts1 I was using the validate(...) method in the Form class.
>>
>> It seems none of the Struts2 validation examples on the net are working
>> for=  me.
>>
>>
>
> You haven't mentioned whether you're using XML validation or
> annotation-based validation.  If by not working you mean "does nothing",
> then your XML file is probably incorrectly named or your missing an
> annotation.  (You need to enable this separately from client-side
> validation)
>
> Whatever the case, the main difference between Struts1 and Struts2 here is
> that Struts2 performs validation on the Object, not on the form parameters.
> That means, to check that "fieldName" is non-blank, it will call
> getFieldName() after setFieldName() was called by the ParametersInterceptor.
>
> A common problem is to forget the getter, but in that case Struts will keep
> returning INPUT (validation failed) instead of invoking your action.
>
> Hope that helps,
> Jeromy Evans
>
>
>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to