File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Basic question on ApplicationResources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Basic question on ApplicationResources" Watch "Basic question on ApplicationResources" New topic

Basic question on ApplicationResources

jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Was wondering where you can use the keywords that are defined in your .properties file? Might sound like a silly question, but I've seen them used both in JSP tags as well parameters for ActionError. Is there any other way to use the keywords defined in there?
For example, if I define services.path=/WEB-INF/ in my ApplicationResource bundle, in my extended ActionServlet I want to be able to do the following:
ServiceFactory factory = ServiceFactory.getFactory( context.getResourceAsStream( "services.path" ) );
Originally I had this as an init parameter and got the info using config.getInitParameter("services");, but was curious if there is a way to use the file for this instead.
[ December 16, 2002: Message edited by: jason adam ]
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

you can try this in an ActionForm or Action:

I think the initParameter approach is better though because putting it in the ApplicationResources could be confusing later: if you want to do I18N, are you going to translate the path as well?
[ December 17, 2002: Message edited by: Junilu Lacar ]

Junilu - [How to Ask Questions] [How to Answer Questions]
I agree. Here's the link:
subject: Basic question on ApplicationResources
It's not a secret anymore!