Get your CodeRanch badge!*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Basic question on ApplicationResources" Watch "Basic question on ApplicationResources" New topic
Author

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/services.properties 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 ApplicationResource.properties file for this instead.
Thanks!
Jason
[ December 16, 2002: Message edited by: jason adam ]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

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: http://aspose.com/file-tools
 
subject: Basic question on ApplicationResources
 
Similar Threads
JAVA source editor
Making site in different languages
invalidate a session by using session id
Dr. Hunt's error?
ActionErrors (Struts)