You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eugen Stoianovici <eu...@gmail.com> on 2007/10/22 10:38:21 UTC

[S2]ActionSupport set parameters question.

I'm having trouble understanding how ActionSupport works. I've extended 
ActionSupport to handle a form page. If the from contains errors (ie: i 
have an amount field mapped like <s:text name="invoice.amount"/> and the 
user types in "asdf") the action mapped to result type "execute" is 
never called and, even though the form si set to not perform validation.

I want to handle errors trough code (rather than providing an xml for 
it). What do i need to override to handle this type or errors?

-- 
Regards,
Eugen Stoianovici


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


Re: [S2]ActionSupport set parameters question.

Posted by Eugen Stoianovici <eu...@gmail.com>.
Thank you, it's just what i needed
David Harland wrote:
> Add something like this to your action
>
> public void validate() {
>   User user = getUser();
>   if (StringUtils.isBlank(user.getName())) {
>     addActionError(getText("user.name.empty"));
>   }
>   if (StringUtils.isBlank(user.getAddress())) {
>     addActionError(getText("user.address.empty"));
>   }
> }
>
> Have a look at 
>
> http://today.java.net/pub/a/today/2006/01/19/webwork-validation.html
>  
> --- Eugen Stoianovici <eu...@gmail.com>
> wrote:
>
>   
>> I'm having trouble understanding how ActionSupport
>> works. I've extended 
>> ActionSupport to handle a form page. If the from
>> contains errors (ie: i 
>> have an amount field mapped like <s:text
>> name="invoice.amount"/> and the 
>> user types in "asdf") the action mapped to result
>> type "execute" is 
>> never called and, even though the form si set to not
>> perform validation.
>>
>> I want to handle errors trough code (rather than
>> providing an xml for 
>> it). What do i need to override to handle this type
>> or errors?
>>
>> -- 
>> Regards,
>> Eugen Stoianovici
>>
>>
>>
>>     
> ---------------------------------------------------------------------
>   
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>>
>>
>>     
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


-- 
Regards,
Eugen Stoianovici


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


Re: [S2]ActionSupport set parameters question.

Posted by David Harland <ha...@yahoo.com>.
Add something like this to your action

public void validate() {
  User user = getUser();
  if (StringUtils.isBlank(user.getName())) {
    addActionError(getText("user.name.empty"));
  }
  if (StringUtils.isBlank(user.getAddress())) {
    addActionError(getText("user.address.empty"));
  }
}

Have a look at 

http://today.java.net/pub/a/today/2006/01/19/webwork-validation.html
 
--- Eugen Stoianovici <eu...@gmail.com>
wrote:

> I'm having trouble understanding how ActionSupport
> works. I've extended 
> ActionSupport to handle a form page. If the from
> contains errors (ie: i 
> have an amount field mapped like <s:text
> name="invoice.amount"/> and the 
> user types in "asdf") the action mapped to result
> type "execute" is 
> never called and, even though the form si set to not
> perform validation.
> 
> I want to handle errors trough code (rather than
> providing an xml for 
> it). What do i need to override to handle this type
> or errors?
> 
> -- 
> Regards,
> Eugen Stoianovici
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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