简体   繁体   中英

Where to creating properties file for reading values in a Web application deployed on Weblogic(Linux)

I have a Web application consisting of JSPs, Servlets and Java classes developed in Jdeveloper in Windows.

This applicaiton need to be deployed as WAR in Weblogic over a linux box. Some of the servlet and Java classes have certain values hardcoded. I want to avoid this but for obvious reasons. Therfore I was thinking of using the properties file.

Now where do i create this properties file in my jdeveloper so that when i create war file of it and and deploy to a Weblogic server, i have access to this Properties file or how should i code it my program so that wherever I put this properties file on my linux like \\u01\\cap\\domain\\machine\\domain_name\\readvalues.properties. t is able to read it.

and then how do i mention the path in linux. Can you please help me with the code

Stick the properties file in your war file and access it like you would any other properties file via:

props.load(MyClass.class.getResourceAsStream("/someProps.properties"));

The best place to put the properties file is in the /WEB-INF/classes folder. So you need to load the properties files relative to that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM