0

I have a properties xml file, example:

<properties>
  <entry key="message.first">Hello</entry>
  <entry key="message.second">Hi</entry>
</properties>

and I want get the value from properties file and check if value is exist on the jsp page.

Example:

if(message.first != null) {
     action
}

I don't now how get value from properties file and use in if statment on jsp page.

The Nightmare
  • 701
  • 5
  • 16
  • 36

1 Answers1

3

For Loading properties.xml File :-

    Properties properties = new Properties();
    properties.loadFromXML(new FileInputStream("props.xml")); //path of XML file
    String  firstname = properties.getProperty("firstname");

For Sending it to JSP Page :-

    request.setAttribute("firstname ", firstname )
    request.getRequestDispatcher("NEWPAGE.jsp").forward(request, response);
AnkeyNigam
  • 2,810
  • 4
  • 15
  • 23