• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to read .properties file from action class

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm new to struts,

I want to read key/value pair to String object in action class.

I'm able to read it in jsp like <jsp:message key=form.msg>

but not in action class.

thanks in advance ..!
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You can use MessageResources to read the properties file in Action class.
In execute method, you can give like this..
MessageResources msgResource = getResources(request);
This will read the message resource file specified in struts-config.xml
(<message-resources parameter="ApplicationResources"/>

Then you can use getMessage() method on MessageResources to fetch the messages.

Regards,
Suresh.
 
zimbu bolleddu
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
very many thanks

it is working fine.....
 
reply
    Bookmark Topic Watch Topic
  • New Topic