You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stefan Schwarz <cm...@gmx.net> on 2008/03/18 16:07:23 UTC

Checking Field Error

Hi,

I've been looking for a check (in a JSP) if a certain field has an error
assigned.

I know (so far) that I can display the error message by using:

<s:fielderror>
    <s:param value="%{'<fieldName>'}" />
</s:fielderror>

That's not what I'm looking for. I want to display a block if the field has
an error like:

<s:if test="...<CheckIamLookingFor>...">
     display this...
     display that...
</s:if>

Is there a way?

thx,
Stefan
-- 
View this message in context: http://www.nabble.com/Checking-Field-Error-tp16122105p16122105.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


Re: Checking Field Error

Posted by Dave Newton <ne...@yahoo.com>.
--- Stefan Schwarz <cm...@gmx.net> wrote:
> I want to display a block if the field has an error like:
> 
> <s:if test="...<CheckIamLookingFor>...">
>      display this...
>      display that...
> </s:if>
> 
> Is there a way?

JavaDocs are your friend. ActionSupport's getFieldErrors method [1] returns a
map keyed from the input field name.

Dave

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


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