So what are you after? Why do you need to use a value from the resources as the message property?
Niall ----- Original Message ----- From: "Chris Cheshire" <[EMAIL PROTECTED]> Sent: Friday, February 17, 2006 7:09 AM Yes what I have in my code is exactly what is in the example. It is not however what I am after. What is the point of using things from the resource bundle if it only works through 3/4 of the application? I have the error message next to the input field, by hardcoding the result of what would be a lookup to the resource bundle, as in that example. I don't want that. I want to be able to look up the value just like the bean:message tag does. On 2/16/06, Niall Pemberton <[EMAIL PROTECTED]> wrote: > Did you try my suggestion - I believe that will do exactly what you want - > you seem to be getting confused between the key used to store the > ActionErrors in the request (global error key) and the property under which > a message is stored in the ActionErrors. > > The validwhen example in the struts-examples does exactly what you say (show > error messages next to their respective form fields) - so you could take a > look at that (struts-examples.war in the binary distro): > > http://tinyurl.com/c2emd > > I think if you make the change I suggested it will do what you want - maybe > its worth a try? > > Niall > > From: "Chris Cheshire" <[EMAIL PROTECTED]> > Sent: Friday, February 17, 2006 3:36 AM > > > That's not the issue, it is actually doing that, via a resource bundle > lookup (I only have one configured). I want to be able to retrieve the > error on the jsp side by getting the key via the resource bundle > similar to the way it is being added, instead of just using the value > that is referenced in the resource bundle. > > The field label is being printed via a message bundle lookup (using > bean:message tag), and the error for that field is stored using that > same key. > > I want to retrieve the error not by the discrete value "password", but > by a key lookup to the message bundle that produces the value > "password". > > Chris > On 2/16/06, Niall Pemberton <[EMAIL PROTECTED]> wrote: > > Modify your code to do this: > > > > errors.add("password", message); > > > > > http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html#section5 > > > > Niall > > > > ----- Original Message ----- > > From: "Chris Cheshire" <[EMAIL PROTECTED]> > > Sent: Friday, February 17, 2006 1:50 AM > > > > > > I have an ActionForm with its own validate method that adds errors > > keyed upon entries in a resource bundle, so that the errors can be > > linked back to the field they are pertinent to, not just as a global > > error. > > > > String label = resources.getMessage("label.password"); > > ActionMessage message = new > > ActionMessage("validation.error.requiredfield", label); > > errors.add(label, message); > > > > > > I have the error displaying next to the input field in the jsp page via : > > > > <td><b><bean:message key="label.password" /></b></td> > > <td><html:password property="password" size="20" > > maxlength="20" /></td> > > <td> > > <html:messages id="message" message="false" > property="password"> > > <bean:write name="message" /><br> > > </html:messages> > > </td> > > > > Unfortunately the value of "property" is hardcoded in the > > html:messages tag. What I have there is the value stored in the > > resource bundle under "label.password", as is used to display next to > > the input field in the bean:message tag. > > > > How can I extract the value from the resource bundle when using it as > > a value for the property field, instead of hard coding it in, which > > defeats the purpose of the resource bundle. > > > > Thanks > > > > Chris > > > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]