passing substitution parameters to ActionError still working?
I have a form where I call the following (where UserForm.MIN_PASSWORD_LENGTH is an int): errors.add("password", new ActionError("error.user.passwordinvalid", String.valueOf(UserForm.MIN_PASSWORD_LENGTH))); which references this in the ApplicationResource.properties file: error.user.passwordinvalid=liThe password must contain at least {0} characters./li But the html:error tag displays this: The password must contain at least [Ljava.lang.Object;@14f467 characters. I could have sworn that this used to work but it doesn't anymore for me. Does passing parameters to ActionError objects still work for everyone with recent builds? If it still works then I must have broke something. Thanks, Hal
RE: passing substitution parameters to ActionError still working?
I changed UserForm.MIN_PASSWORD_LENGTH to an Integer from an int but I am still getting the same problem. Isn't MK Kan Leunghaving the same problem as me?Here is his post repeated: Hi all, Ihave a property file like this: common.copyright={0} Copyright I used the following tag to retrieve the message: bean:message key="common.copyright" arg0="2001"/ The displayed message becomes: [Ljava.lang.Object;@47393f Copyright Any clue? -Original Message-From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]Sent: Wednesday, February 21, 2001 7:27 PMTo: [EMAIL PROTECTED]Subject: Re: passing substitution parameters to ActionError still working?"Deadman, Hal" wrote: I have a form where I call the following (where UserForm.MIN_PASSWORD_LENGTH is an int):errors.add("password", new ActionError("error.user.passwordinvalid", String.valueOf(UserForm.MIN_PASSWORD_LENGTH)));which references this in the ApplicationResource.properties file:error.user.passwordinvalid=liThe password must contain at least {0} characters./liBut the html:error tag displays this: The password must contain at least [Ljava.lang.Object;@14f467 characters. I could have sworn that this used to work but it doesn't anymore for me. Does passing parameters to ActionError objects still work for everyone with recent builds? If it still works then I must have broke something.Thanks, Hal You should be able to pass the length as an object of type Integer, and let the message formatting methods worry about converting it to a String: errors.add("password", new ActionError("error.user.passwordinvalid", new Integer(UserForm.MIN_PASSWORD_LENGTH)); The parameter values are all Objects rather than Strings. Craig
Re: passing substitution parameters to ActionError still working?
"Deadman, Hal" wrote: I have a form where I call the following (where UserForm.MIN_PASSWORD_LENGTH is an int):errors.add("password", new ActionError("error.user.passwordinvalid", String.valueOf(UserForm.MIN_PASSWORD_LENGTH)));which references this in the ApplicationResource.properties file:error.user.passwordinvalid=li>The password must contain at least {0} characters./li>But the html:error tag displays this: The password must contain at least [Ljava.lang.Object;@14f467 characters. I could have sworn that this used to work but it doesn't anymore for me. Does passing parameters to ActionError objects still work for everyone with recent builds? If it still works then I must have broke something.Thanks, Hal You should be able to pass the length as an object of type Integer, and let the message formatting methods worry about converting it to a String: errors.add("password", new ActionError("error.user.passwordinvalid", new Integer(UserForm.MIN_PASSWORD_LENGTH)); The parameter values are all Objects rather than Strings. Craig