I put the following in a DIV at the top of every page:
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:include value="/pages/common/jsps/header.jsp" />
<body>
<div id='top_div'>
<h1><s:text name="co_title"/></h1>
<s:include value="/pages/common/jsps/menu.jsp" />
</div>
<div id="body_div">
<s:if test="hasErrors()">
<h1 class="error"><s:property
value='getText("co_error")'/></h1>
<ul>
<s:if test="hasActionErrors()">
<s:iterator
value="actionErrors">
<li
class="error"><s:property/></li>
</s:iterator>
</s:if>
<s:if test="hasFieldErrors()">
<s:iterator
value="fieldErrors">
<s:iterator
value="value">
<li
class="error"><s:property/></li>
</s:iterator>
</s:iterator>
</s:if>
</ul>
</div>
</s:if>
<s:include value="/pages/common/jsps/footer.jsp" />
>-----Original Message-----
>From: james billa [mailto:[email protected]]
>Sent: Friday, October 09, 2009 12:25 PM
>To: [email protected]
>Subject: Do something based on existence of action error - How?
>
>Hi ,
>
>I am using Struts 2.1.6. I want to show the content a <tr> only if
>action
>error exists. If not I don't want to show the content of my <tr>. How do
>I
>check whether action error exists or not in my page? The action error is
>set
>by my action class if there is an error.
>
>I have done to coding (CSS) to show or hide the <tr>. But not sure how
>to
>implement it by checking the action error. Thanks.
>
>Thanks
>JB
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]