开发者

How to make a custom configuration in Struts 2?

I like to create an XML or a property file for my key and value pairs.

For example, I like to save a url in an XML or a property file and then get the value of it in my classes.

I know that I can create an XML file and then use an XML parser to do it, but is there a standard way of doing it in Struts 2?

I'm pretty new to开发者_StackOverflow Struts 2..so feel free to suggest anything!

Thank you in advances!


If I have understood your question correctly, I don't think there is anything special required in struts2 for this, you can use standard java.util.Properties

Properties props = new Properties();
props.load( new FileInputStream("url.properties"));
...
props.get("someurl");

in your url.properties

someurl=http://someurlsite.com/some/url
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜