Satish

ActionErrors isn't deprecated, ActionError is...

http://struts.apache.org/api/org/apache/struts/action/ActionErrors.html

ActionErrors errors = new ActionErrors();
errors.add("myproperty" , new ActionMessage(...));
return errors;


And then personally i prefer

<html:errors property="myproperty" />

But there are good reasons for preferring html:messages as you can hide whole sections of unwanted html using them..

Mark

On 25 Sep 2004, at 17:17, Michael McGrady wrote:

Sorry, left out the "ERRORS" sort of header.

Michael McGrady

<!--==========================================================
ERRORS
===========================================================-->
<logic:messagesPresent>
<ul>
<html:messages id='error'>
<li>
<font size='+1'>
<bean:write name='error'/>
</font>
</li>
</html:messages>
</ul>
</logic:messagesPresent>
<!--==========================================================
MESSAGES
===========================================================-->
<logic:messagesPresent message='true'>
<ul>
<html:messages id='message' message='true'>
<li>
<font size='+1'>
<bean:write name='message'/>
</font>
</li>
</html:messages>
</ul>
</logic:messagesPresent>


Satish Talim wrote:

Hello,

I am using Struts 1.2.4 on JBoss 3.2.5.

In my ActionForm validate method, I have the following code -
   ActionErrors errors = new ActionErrors();
   ActionMessages messages = new ActionMessages();
   ActionMessage msg = null;
   if (getLoginID() == null || getLoginID().length() < 1)
   {
     msg = new ActionMessage("errors.loginID.required");
     messages.add(ActionMessages.GLOBAL_MESSAGE, msg);
     errors.add(ActionMessages.GLOBAL_MESSAGE, msg);
   }
   request.setAttribute("messages", messages);
   return errors;

I did this, since I don't want to use ActionErrors and ActionError (as these are deprecated). Now in my JSP view I want to display the message, but am not clear what I need to do. I tried the following, but it does not work ie. no messages are displayed on the screen.
<%@ taglib uri="http://struts.apache.org/tags-html-el"; prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean-el"; prefix="bean" %>
<html:messages id="messages" message="true">
<li><bean:message name="messages"/></li>
</html:messages>


What am I doing wrong and what's the right solution?

All help most appreciated.

Regards,

Satish Talim






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to