Struts - Alternative of <html:errors />
to display error messages in Jsp?
views:
507answers:
1
+1
A:
By setting the attribute message="false"
on the <html:messages />
tag, it gets all errors stored on ActionMessages
list if saveErrors
was called.
<logic:messagesPresent message="false">
<html:messages id="aMsg" message="false">
<logic:present name="aMsg">
<!-- Error -->
<div class="error">
<bean:write name="aMsg" filter="false" />
</div>
</logic:present>
</html:messages>
</logic:messagesPresent>
The <html:messages id="aMsg" message="false">
display messages stored on saveErrors
while <html:messages id="aMsg" message="true">
display messages stored on saveMessages
. There is no more ActionErrors
object, just ActionMessages
. The 'saveErrors' and 'saveMessages' method seperates the errors and messages respectively.
The Elite Gentleman
2010-03-06 17:37:18
Actually I wanted to use <html:errors /> for displaying errors but I couldn't find struts-html.tld file that's why I moved to other alternative approaches... Could you please tell me the answer of the question at http://stackoverflow.com/questions/2388133/struts-in-which-jar-file-all-the-tld-files-located
Yatendra Goel
2010-03-06 18:33:21
<html:errors /> has been removed on the newer versions of Struts. It hasn't been removed on the TLD's since Struts have long removed their TLD's from the Struts set. They just keeping it for backward compatibility purposes. Rather use JSTL has it's compatible to be used with Struts.
The Elite Gentleman
2010-03-06 22:09:57