You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by st...@hullegard.com on 2007/08/13 18:31:21 UTC

Get an error message using but not print it?

Hi,

I have searched but found nothing about this. How can I fetch an specific error
using <html:errors property="something"> without printing it to the page? Or
somehow check if it exists?

I want this because I want to print the error with some styling in the html. But
I don't want that styling code to be in the html if the message doesn't exist,
and I don't want any styling code in the resource file.

There must be lots of people who have done this before, right?

Example:
<html:password property="password"/>
<struts:if-error-exists property="password">
<div class="error">
<html:errors property="password">
</div>
</struts:if-error-exists>

Regards
/Jimi

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


Re: Get an error message using but not print it?

Posted by st...@hullegard.com.
Ah, thanks. Solved my problems :)

/Jimi

Quoting Dave Newton <ne...@yahoo.com>:

> http://struts.apache.org/1.2.9/userGuide/struts-logic.html#messagesPresent
>
> --- struts@hullegard.com wrote:
>
>> Hi,
>>
>> I have searched but found nothing about this. How
>> can I fetch an specific error
>> using <html:errors property="something"> without
>> printing it to the page? Or
>> somehow check if it exists?
>>
>> I want this because I want to print the error with
>> some styling in the html. But
>> I don't want that styling code to be in the html if
>> the message doesn't exist,
>> and I don't want any styling code in the resource
>> file.
>>
>> There must be lots of people who have done this
>> before, right?
>>
>> Example:
>> <html:password property="password"/>
>> <struts:if-error-exists property="password">
>> <div class="error">
>> <html:errors property="password">
>> </div>
>> </struts:if-error-exists>
>>
>> Regards
>> /Jimi
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>>
>>
>
>
>
>      
> ____________________________________________________________________________________
> Park yourself in front of a world of choices in alternative vehicles. 
> Visit the Yahoo! Auto Green Center.
> http://autos.yahoo.com/green_center/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



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


Re: Get an error message using but not print it?

Posted by Dave Newton <ne...@yahoo.com>.
http://struts.apache.org/1.2.9/userGuide/struts-logic.html#messagesPresent

--- struts@hullegard.com wrote:

> Hi,
> 
> I have searched but found nothing about this. How
> can I fetch an specific error
> using <html:errors property="something"> without
> printing it to the page? Or
> somehow check if it exists?
> 
> I want this because I want to print the error with
> some styling in the html. But
> I don't want that styling code to be in the html if
> the message doesn't exist,
> and I don't want any styling code in the resource
> file.
> 
> There must be lots of people who have done this
> before, right?
> 
> Example:
> <html:password property="password"/>
> <struts:if-error-exists property="password">
> <div class="error">
> <html:errors property="password">
> </div>
> </struts:if-error-exists>
> 
> Regards
> /Jimi
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



      ____________________________________________________________________________________
Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.
http://autos.yahoo.com/green_center/ 

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