Hello Every one,
please tell me how to use dotproperty file in jsp?
like i m trying to code a login page and i want if any user input wrong or null value so on the same page msg should come like please enter correct username or something like that.....


please help me.....

And why do you need properties file for this. Why don't you try javascript?

Put .properties files into WEB-INF/classes folder. Use JSTL to read properties values.

Please tell me site from where i can get example code so ithat i can get it easily...
please help me.

localization.jsp - put this file in public folder (anywhere but outside the WEB-INF).

<%@ page language="java" pageEncoding="ISO-8859-1" %>
<%@ taglib uri="/WEB-INF/c-rt.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/x-rt.tld" prefix="x" %>
<%@ taglib uri="/WEB-INF/fmt-rt.tld" prefix="fmt" %>
<html>
<body>
<form>
  Language <select name="cnt">
               <option value="hi_IN">Hindi</option>
               <option value="en_GB">English</option>
           </select>
           <input type="submit" value="Select">
</form>
<fmt:setLocale value="${param.cnt}"/>
    <fmt:setBundle basename="labels"/>
    <h2>Survey</h2>
    <form action="">
    <table>
      <tr>
        <td><fmt:message key="name"/></td>
        <td><input type="text" size="16"></td>
      </tr>
      <tr>
        <td><fmt:message key="age"/></td>
        <td><input type="text" size="16"></td>
      </tr>
      <tr>
        <td><fmt:message key="loc"/></td>
        <td><input type="text" size="16"></td>
      </tr>
      <tr>
        <td><input type="submit" value='<fmt:message key="submit"/>'></td>
      </tr>
    </table>
    </form>
  </body>
</html>

Create .properties file into WEB-INF/classes folder. Name of property file is user-defined. In this example, I have used "labels".
See this code,
<fmt:setBundle basename="labels"/>

for english culture a property file name should be,
labels_en.properties
for other cultures change the suffix en and create a new property file,
for example, hindi (indian) culture,
labels_hi.properties

Content of labels_en.properties

name=What is your name?
age=How old are you?
loc=Where do you live?
submit=Send
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.