messages help

2005-08-22 Thread draegoon Z

Sorry, but I've been reading archives all morning.

Using Struts 1.2.7

Setting up a system to catch all errors/messages on a page.

Getting the errors from my ActionForm:

ActionErrors errors = new ActionErrors();
errors.add(system_name,new 
ActionError(errors.required,ar.getMessage(com.draegoonZ.social.label.system_name)));

return(errors);

Getting the ???bad_key??? from my ActionForm:

ActionMessages errors = new ActionMessages();
errors.add(system_name,new 
ActionMessage(ar.getMessage(com.draegoonZ.social.password.lookup.no_user_name)));

saveMessages(request,errors);
return(mapping.getInputForward());

Results in: ???en_US.That username doesn't exist in our system. Please try 
again.???


Now I don't know what key it is telling me is missing,
when it is displaying the value from my messages resource.

I thought the problem was with using the property (system_name)
instead of ActionMessages.GLOBAL_MESSAGE, but that gave the
same results.

Also, I want to use the property name, so I can display next to the html: 
input tag.


A related question I have is:

I read somewhere (this morning) that once html:message is read/accessed that 
it is removed/deleted.

Is this true?
How then could one list all the errors/messages at the top of a page,
and then check for them to display next to the html: input tag?


My jsp reads:

%-- check for errors --%
logic:messagesPresent
   html:messages id=message_id header=errors.header 
footer=errors.footer

   lic:out value=${message_id} //li
   /html:messages
   /logic:messagesPresent

   %-- If not errors present... --%
   logic:messagesNotPresent

   %-- check for messages (Globals.MESSAGE_KEY) --%
   logic:messagesPresent message=true
   html:messages id=message_id message=true 
header=errors.header footer=errors.footer

   lic:out value=${message_id} //li
   /html:messages
   /logic:messagesPresent
   /logic:messagesNotPresent


Thanx in advance.



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



Re: messages help

2005-08-22 Thread glenn . deschenes
Did you read this ?
http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html

Especially the section 4.2 Using a Custom Key.

HTH,
Glenn




draegoon Z [EMAIL PROTECTED] 
22/08/2005 02:19 PM
Please respond to
Struts Users Mailing List user@struts.apache.org


To
struts-user@jakarta.apache.org
cc

Subject
messages help






Sorry, but I've been reading archives all morning.

Using Struts 1.2.7

Setting up a system to catch all errors/messages on a page.

Getting the errors from my ActionForm:

ActionErrors errors = new ActionErrors();
errors.add(system_name,new 
ActionError(errors.required,ar.getMessage(com.draegoonZ.social.label.system_name)));
return(errors);

Getting the ???bad_key??? from my ActionForm:

ActionMessages errors = new ActionMessages();
errors.add(system_name,new 
ActionMessage(ar.getMessage(com.draegoonZ.social.password.lookup.no_user_name)));
saveMessages(request,errors);
return(mapping.getInputForward());

Results in: ???en_US.That username doesn't exist in our system. Please try 

again.???

Now I don't know what key it is telling me is missing,
when it is displaying the value from my messages resource.

I thought the problem was with using the property (system_name)
instead of ActionMessages.GLOBAL_MESSAGE, but that gave the
same results.

Also, I want to use the property name, so I can display next to the 
html: 
input tag.

A related question I have is:

I read somewhere (this morning) that once html:message is read/accessed 
that 
it is removed/deleted.
Is this true?
How then could one list all the errors/messages at the top of a page,
and then check for them to display next to the html: input tag?


My jsp reads:

 %-- check for errors --%
 logic:messagesPresent
html:messages id=message_id header=errors.header 
footer=errors.footer
lic:out value=${message_id} //li
/html:messages
/logic:messagesPresent

%-- If not errors present... --%
logic:messagesNotPresent

%-- check for messages (Globals.MESSAGE_KEY) --%
logic:messagesPresent message=true
html:messages id=message_id message=true 
header=errors.header footer=errors.footer
lic:out value=${message_id} //li
/html:messages
/logic:messagesPresent
/logic:messagesNotPresent


Thanx in advance.



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