• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

adding dynamic value to properties file.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In struts we place key and value information in properties file for displaying message.

in java page

ActionMessage msg = new ActionMessage("errorupload.empty");
exMsg.add("message1", msg);
saveErrors(request, exMsg);
return mapping.findForward("entersheet");

in application.properties
errorupload.empty=please enter valid sheet.

whenever any thing goes wrong i get the message please enter valid sheet.
I want to add dynamic information to these messages. like it should take some value from java page and display dynamically that information along with message.


thanks
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know how to add dynamic values in properties file, but you can definitely have those message as per the java code , like this what I do in my Action class



You can have <html:errros/> tag to display this error to users !
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can add replaceable parameters to messages like this:

Properties file:

Code in Action:

The message would then read:

Sheet 1234 is invalid. Enter valid sheet.

 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic