我有一个属性xml文件,例如:
<properties>
<entry key="message.first">Hello</entry>
<entry key="message.second">Hi</entry>
</properties>我希望从属性文件中获取值,并检查jsp页面中是否存在值。
示例:
if(message.first != null) {
action
}我现在不知道如何从属性文件中获取值并在jsp页面上的if状态中使用。
发布于 2015-07-20 19:53:31
用于加载文件的properties.xml文件:-
Properties properties = new Properties();
properties.loadFromXML(new FileInputStream("props.xml")); //path of XML file
String firstname = properties.getProperty("firstname");,用于将其发送到JSP页面 :-
request.setAttribute("firstname ", firstname )
request.getRequestDispatcher("NEWPAGE.jsp").forward(request, response);https://stackoverflow.com/questions/31524870
复制相似问题