Re: Feedback messages with parameter substitution
Or... Object[] vars = ...add dynamic file name object StringResourceModel rModel = new StringResourceModel(message.fileAlreadyUploaded, null, vars); error(rModel.getObject()); From: James james.eliye...@gmail.com To: users@wicket.apache.org Date: 01/04/2011 09:22 PM Subject:Re: Feedback messages with parameter substitution Folks, I found the solution from the thread Using getString with parameters http://apache-wicket.1842946.n4.nabble.com/Usage-of-getString-with-parameters-model-td1875254.html . And this is what I did in the properties file.. premessage.fileAlreadyUploaded=The file ${0} is already uploaded/pre (Note the $ sign) And in the java code.. error(getString(message.fileAlreadyUploaded, new Model(new String[]{fileUpload.getClientFileName()}))); It worked like a charm. On Wed, Jan 5, 2011 at 10:00 AM, James james.eliye...@gmail.com wrote: Dear friends, Please forgive me if this question is asked before and answered. I seriously searched for this in the mailing list and other areas and couldn't find any solution. I've seen great examples of using StringResourceModel for parameter substitution in components like Label. But what I want is to display a feedback message, say an error message with some dynamic values in it. Something like The file abc.txt is already uploaded, where abc.txt shall be dynamic. So the localized text in the properties file would be something like message.fileAlreadyUploaded=The file {0} is already uploaded. I've tried using something like this... code error(getString(message.fileAlreadyUploaded, new Model(new String[]{fileUpload.getClientFileName()}))); /code but that' doesn't work..I also tried using StringResourceModel but to no avail. I know I'm doing something wrong, please guide me to solve this problem. -- Thanks Regards, James -- Thanks Regards, James Notice: This communication, including any attachments, is intended solely for the use of the individual or entity to which it is addressed. This communication may contain information that is protected from disclosure under State and/or Federal law. Please notify the sender immediately if you have received this communication in error and delete this email from your system. If you are not the intended recipient, you are requested not to disclose, copy, distribute or take any action in reliance on the contents of this information.
Feedback messages with parameter substitution
Dear friends, Please forgive me if this question is asked before and answered. I seriously searched for this in the mailing list and other areas and couldn't find any solution. I've seen great examples of using StringResourceModel for parameter substitution in components like Label. But what I want is to display a feedback message, say an error message with some dynamic values in it. Something like The file abc.txt is already uploaded, where abc.txt shall be dynamic. So the localized text in the properties file would be something like message.fileAlreadyUploaded=The file {0} is already uploaded. I've tried using something like this... code error(getString(message.fileAlreadyUploaded, new Model(new String[]{fileUpload.getClientFileName()}))); /code but that' doesn't work..I also tried using StringResourceModel but to no avail. I know I'm doing something wrong, please guide me to solve this problem. -- Thanks Regards, James
Re: Feedback messages with parameter substitution
Folks, I found the solution from the thread Using getString with parametershttp://apache-wicket.1842946.n4.nabble.com/Usage-of-getString-with-parameters-model-td1875254.html . And this is what I did in the properties file.. premessage.fileAlreadyUploaded=The file ${0} is already uploaded/pre (Note the $ sign) And in the java code.. error(getString(message.fileAlreadyUploaded, new Model(new String[]{fileUpload.getClientFileName()}))); It worked like a charm. On Wed, Jan 5, 2011 at 10:00 AM, James james.eliye...@gmail.com wrote: Dear friends, Please forgive me if this question is asked before and answered. I seriously searched for this in the mailing list and other areas and couldn't find any solution. I've seen great examples of using StringResourceModel for parameter substitution in components like Label. But what I want is to display a feedback message, say an error message with some dynamic values in it. Something like The file abc.txt is already uploaded, where abc.txt shall be dynamic. So the localized text in the properties file would be something like message.fileAlreadyUploaded=The file {0} is already uploaded. I've tried using something like this... code error(getString(message.fileAlreadyUploaded, new Model(new String[]{fileUpload.getClientFileName()}))); /code but that' doesn't work..I also tried using StringResourceModel but to no avail. I know I'm doing something wrong, please guide me to solve this problem. -- Thanks Regards, James -- Thanks Regards, James