Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to read properties from property file in jsp?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 13.8k
    Comment on it

    Create a property file in the package with extension '.properties' and use those properties defined in the file in jsp by importing the resource bundle package in the jsp.

    Example:

    config.properties

    name=tom
    email=tom@gmail.com
    phone=22222
    

    login.jsp

     <%@ page import = "java.util.ResourceBundle" %>
    
     <% ResourceBundle resource = ResourceBundle.getBundle("config");
    
        String name=resource.getString("name");
        String email=resource.getString("email");
        String phone=resource.getString("phone");
         %>
    
        Name:  <input type="text" id="name" value="<%=name %>">
        Email: <input type="text" id="email" value="<%=email %>">
        Phone: <input type="text" id="phone" value="<%=phone %>">
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: