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.

3
  • 3
    Duplicate of stackoverflow.com/questions/1140653/… Commented Jul 20, 2015 at 19:42
  • @MickMnemonic Sorry, my mistake this is xml properties file. Commented Jul 20, 2015 at 19:56
  • 1
    I think you can still use the advice in the dupe, using loadFromXML for loading the data. Commented Jul 20, 2015 at 19:57

1 Answer 1

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.