You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jack Xu <c5...@hotmail.com> on 2001/12/10 16:23:05 UTC
how to detect an error
Hi,
I have a quite dumb question here:
On a JSP page, if I want to check to see whether there exists any ActionError or not, what should I do?
I tried
<logic:present name="errors" property="someproperty">
do something if there is an error
</logic:present>
it doesn't seem to be working.
and <html:errors property="someproperty"> only displays the error message.
Your help will be greatly appreciated.
Jack
Re: how to detect an error
Posted by Burr Sutter <st...@japache.org>.
My sources tell me that the lastest code for Struts 1.1 has a new messagesPresent tag that should do what you need.
Here is a message that I pulled from the archive:
---------------------
If you are using one of the more recent nightly builds
there is a logic tag you could use.
<logic:messagesPresent property="username">
// insert image here
</logic:messagesPresent>
<html:text property="username" size="20"
maxlength="100"/>
David
---------
This was related to adding icons beside the field that had the error message.
Burr
sutter@bravepoint.com
--
Sent via jApache.org
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: how to detect an error
Posted by Jack Xu <c5...@hotmail.com>.
Burr,
Thanks for the help.
<logic:present name="org.apache.struts.action.ERROR" scope="request"> does work, but what if I need to see an error with a certain property exists?
I tried <logic:present name="org.apache.struts.action.ERROR" property="certainproperty" scope="request"> and it doesn't seem to being working.
Any thoughts?
Thanks.
----- Original Message -----
From: "Burr Sutter" <st...@japache.org>
To: <st...@jakarta.apache.org>
Sent: Monday, December 10, 2001 11:04 AM
Subject: Re: how to detect an error
> The following seems to work:
>
> <logic:present name="org.apache.struts.action.ERROR" scope="request">
> <br>There must have been errors!<br>
> </logic:present>
> <logic:notPresent name="org.apache.struts.action.ERROR" scope="request">
> <br>There are no errors.<br>
> </logic:notPresent>
>
> Burr
> sutter@bravepoint.com
> --
> Sent via jApache.org
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
Re: how to detect an error
Posted by Burr Sutter <st...@japache.org>.
The following seems to work:
<logic:present name="org.apache.struts.action.ERROR" scope="request">
<br>There must have been errors!<br>
</logic:present>
<logic:notPresent name="org.apache.struts.action.ERROR" scope="request">
<br>There are no errors.<br>
</logic:notPresent>
Burr
sutter@bravepoint.com
--
Sent via jApache.org
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>