struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boraldo <bora...@hotbox.ru>
Subject Re: How to avoid validation if request was done by GET method?
Date Thu, 26 Mar 2009 18:13:00 GMT

Do I understand properly that ActionSupport.validate method that you used
here performs the same validation as validation interceptor ?

How can I see if there were validation errors ?



benjamin haimerl wrote:
> 
> hi boraldo
> 
> a very simple way should be:
> 
> 
> Action:
> 
> YourActionConnetedToTheFormAction extends Action..{
> 
> execute(..){
> 
> String qString = request.getQueryString();
> if(qString!=null && paramsFound(...))
>    // *paramsFound() = check if your formParams were given by query String
> }
> else {
> //check if your formBean is set (depends on the scope you have set in 
> your struts-config.xml)
> //e.g.
>   if(request.getAttribute(yourForm)!=null) {
>   yourForm.validate() {
> }
>  }
> }
> 
> }
> 
> should work ;)
> 
> 
> 
> boraldo wrote:
>> I have a form. And I want to have one url for form itself and for
>> submitting
>> it.
>> Controller should look at method and if it is GET, show form, if POST -
>> make
>> validations and so on.
>>
>> How can I do it ?
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-avoid-validation-if-request-was-done-by-GET-method--tp22709587p22727895.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message