Struts ActionMessage -


hi have struts 1.x app, , in order show errors detected in action class, use:

errors.add("error global", new actionmessage("some_string_in_properties_file")); 

which works fine.

my problem string need send jsp page error has session variable in (like "you have 3 more valid attempts", being 3 session variable).

how can accomplish ?

thanks.

try use actionmessage constructor of 2 arguments. according javadoc:

 public actionmessage(java.lang.string key,                      java.lang.object value0)  construct action message specified replacement values.  parameters:     key - message key message     value0 - first replacement value 

in case:

 errors.add("error global", new actionmessage("some_string_in_properties_file", sessionvariable));  

some_string_in_properties_file should this:

 some_string_in_properties_file=you have {0} more valid attempt(s) 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -