Hi Nestor, This is a code snippet from a catch clause in an ActionForm class of mine:
... ActionErrors errors = new ActionErrors(); if (this.getValorPorcentual() == null) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("ERROR.CAMPO_OBLIGATORIO", "% a aplicar")); } "ERROR.CAMPO_OBLIGATORIO" is a parametrized error message I'd added to my "dictionary_es.properties" file (located under ...WEB-INF\classes), as follows: ERROR.CAMPO_OBLIGATORIO = El campo \'{0}\' es obligatorio. Finally, this is a code snippet taken from the corresponding JSP: ... <%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> ... <head> ... <script language="JavaScript1.2"> var tokensError = null; function processErrorMessages() { var messages = ''; <logic:messagesPresent> <html:messages id="errorMessages"> messages = messages + '<bean:write name="errorMessages"/>' + '$$$$$'; </html:messages> tokensError = messages.split('$$$$$'); for (var i = 0; i < tokensError.length - 1; i++) { alert(tokensError[i]); } </logic:messagesPresent> } ... function initialize() { // Mostramos los mensajes de error acumulados, // de haberlos. processErrorMessages(); ... } </script> </head> <body onload="javascript: initialize();"> This should give you some hints about what you may be missing, say: - A "properties" file or an entry on that file, - A TLD, - A Java instruction call, - The right key (maybe there is the right entry, but it doesn't match the key you're specifying), - Passing the right data (parameters) to every Java instruction (for instance, a mistake I used to make was passing the text instead of the property file key), - Extracting the messages from your JSP's code, - Having the validate flag correctly set inside your Struts' config. file (in case that's where your error objects get generated), etc...), - Having the resource (property file) correctly configured inside your Struts config. file HTH, Freddy. -----Mensaje original----- De: Néstor Boscán [mailto:[EMAIL PROTECTED] Enviado el: miércoles, 11 de mayo de 2005 22:22 Para: 'Struts Users Mailing List' Asunto: Problems with ActionError Hi I'm trying to use the ActionErrors clases. I'm doing validation on the Action class like this: if (user == null) { errors.add ("username", new ActionError ("errors.fieldisrequired", "username")); } saveErrors (request, errors); Ths resource file is configured correctly. I can do a getMessage inside the action class and it works. In my JSP I show the error like this: <html:errors property="username"/> The error is not generated. The scope is request and the forward has redirect = false. Any ideas? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]