Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to read .properties file from action class

 
zimbu bolleddu
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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 ..!
 
Suresh Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
very many thanks

it is working fine.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic