You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Cosmin Marginean <co...@gmail.com> on 2008/09/10 13:06:28 UTC

Error messages

Hello everyone,

I am trying to provide some custom validation error handling in a JSP. 
For this I would like to perform some logic in the JSP when a validation 
fails, instead (or in addition) of displaying the actual error message.
Is there a way to check if a certain field error has been set?

Thanks in advance,
Cosmin

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


RE: Error messages

Posted by Martin Gainty <mg...@hotmail.com>.
depends on if you want JS validation
action validation
ajax validation

explained at
http://struts.apache.org/2.x/docs/ajax-validation.html

HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Date: Wed, 10 Sep 2008 14:06:28 +0300
> From: cosminaru@gmail.com
> To: user@struts.apache.org
> Subject: Error messages
> 
> Hello everyone,
> 
> I am trying to provide some custom validation error handling in a JSP. 
> For this I would like to perform some logic in the JSP when a validation 
> fails, instead (or in addition) of displaying the actual error message.
> Is there a way to check if a certain field error has been set?
> 
> Thanks in advance,
> Cosmin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
See how Windows connects the people, information, and fun that are part of your life.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/

Re: Error messages

Posted by Dave Newton <ne...@yahoo.com>.
--- On Wed, 9/10/08, Cosmin Marginean wrote:
> Sorry for the misunderstanding - might not have been so
> clear. I meant performing some logic in the JSP. I would 
> like to be able to do something like:
> <td
>     <c:if test="${<an error for field 'xxx' exists>}">
>         class="someErrorClass"
>     </c:if>

...

In that case, use ValidationAware's getFieldErrors().

<s:if test="getFieldErrors('xxx') != null">
  class="someErrorCalss"
</s:if>

(Syntax may be off.)

Dave

> > --- On Wed, 9/10/08, Cosmin Marginean wrote:
>>> Is there a way to check if a certain field errorhas been set?
>> In S2 use ValidationAware's getFieldErrors(...) method.


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


Re: Error messages

Posted by Cosmin Marginean <co...@gmail.com>.
Sorry for the misunderstanding - might not have been so clear. I meant 
performing some logic in the JSP. I would like to be able to do 
something like:
<td
    <c:if test="${<an error for field 'xxx' exists>}">
        class="someErrorClass"
    </c:if>
 >
> --- On Wed, 9/10/08, Cosmin Marginean wrote:
>   
>> Is there a way to check if a certain field error has been set?
>>     
>
> In S2 use ValidationAware's getFieldErrors(...) method.
>
> http://struts.apache.org/2.0.11.2/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html#getFieldErrors()
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


Cosmin Marginean

-- 
cosminaru.ro


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


Re: Error messages

Posted by Dave Newton <ne...@yahoo.com>.
--- On Wed, 9/10/08, Cosmin Marginean wrote:
> Is there a way to check if a certain field error has been set?

In S2 use ValidationAware's getFieldErrors(...) method.

http://struts.apache.org/2.0.11.2/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html#getFieldErrors()

Dave


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