This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Multiple Properties files in web.xml (Struts 1.0.2) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple Properties files in web.xml (Struts 1.0.2)" Watch "Multiple Properties files in web.xml (Struts 1.0.2)" New topic
Author

Multiple Properties files in web.xml (Struts 1.0.2)

Siva Ramky
Greenhorn

Joined: Jul 25, 2008
Posts: 3
Hi,

I need to use two different properties files in my struts project and im facing problem while configuring them in web.xml( im following struts 1.0.2 where the properties file configuration is made in web.xml instead of struts-config.xml)

i tried to use,

....
<init-param>
<param-name>application</param-name>
<param-value>ABCResources</param-value>
</init-param>

<init-param>
<param-name>application</param-name>
<param-value>XYZResources</param-value>
</init-param>
.....

where ABCResources and XYZResources are the names of my two different properites files which i have kept under classes folder.

But the above approach doesnt work and throws xml parsing error during server bootup (unmarshall exception)in weblogic 9.2 , I believe its mainly because of the duplicate 'application' entry.But the same approach worked fine in weblogic 8.1 . Please suggest if there is any work around for weblogic 9.2. Thanks
[ July 25, 2008: Message edited by: Siva Ramky ]
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Originally posted by Siva Ramky:
Hi,

In my project i need to use to different properties files and im facing problem while configuring them in web.xml( im following struts 1.0.2 where the properties file configuration is made in web.xml instead of struts-config.xml)


I never used Struts 1.0, but can you put those .propertise files in struts-config file using <message-resources parameter="MessageResources"/> tag and change your dtd definition to this :



Try this,


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Siva Ramky
Greenhorn

Joined: Jul 25, 2008
Posts: 3
Hi,

Thanks for your post

I have already tried that approach by moving the properties entries to struts-config .. but there i encountered a different error as shown below..

<Servlet: "action" failed to preload on startup in Web application: "webapp".
javax.servlet.UnavailableException: Input/output error reading configuration from resource path /WEB-INF/struts-config.xml
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:468)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:278)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)


This is an age-old project which needs some enhancement now. Still im looking for a workaround.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

I googled this topic and not find any great help .

The init-param are used to get application scoped values, with param-name as a parameter ,So you can change the param name to , say app1 and app2 and used in you application as parameter !
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I don't believe Struts 1.0.2 supports multiple properties files. If you want that feature, you will have to upgrade your project to at least 1.1.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Properties files in web.xml (Struts 1.0.2)