display error message for dupliacate record in properties file

display error message for dupliacate record in properties file

This is my code. Here if the properties file contain duplicate records(i.e.)more than one entry e.x.001,002,003,001 i want to display the error message "Duplicate Record found" while compile the java file.Please give the correct solution soon.

import java.io.*; import java.util.*; public class Sample2 { String message; public Sample2() {

       }
       public void setMessage()
       {
        Properties props = new Properties();

try {

     props.load(new FileInputStream("message.properties"));


     message = props.getProperty("002");

         System.out.println(message);
        for (Enumeration e = props.propertyNames();
        e.hasMoreElements();) {

} }

  catch(IOException e)
         {

        e.printStackTrace();

        }
 }
public static void main(String[] args)

     {

    Sample2 gr = new Sample2();

    gr.setMessage();

 }

}

View Answers









Related Tutorials/Questions & Answers:
display error message for dupliacate record in properties file
display error message for dupliacate record in properties file  This is my code. Here if the properties file contain duplicate records(i.e.)more than one entry e.x.001,002,003,001 i want to display the error message "Duplicate
Display error message if data is already inserted in database
Display error message if data is already inserted in database   Display error message if data is already inserted in database Pls help me Thanks
Advertisements
How to read and display data from a .properties file from a jsp page
How to read and display data from a .properties file from a jsp page  I have a .properties file. I have to create a jsp page such that it reads the data from this .properties file and display it in table format. Ex:by using
error message
error message  Sir i make one form facility with insert,update,delete.i want to error msg if any type of the data is missing and display in error msg which of the data is misssing
Error display
Error display  I want to give a message on the screen that an error has occured...but I dont want to use alert and give pop up box...any other solution for the problem
error display
error display  I am creating a web page...I have two textboxes and an add button. If nothing has been entered in the textboxes and if I click the add button , I have to get pop up box indicating that "please fill in the fields
javascript dom error-message
javascript dom error-message  javascript dom error-message
forward error message in struts
forward error message in struts  how to forward the error message got in struts from one jsp to other jsp?   Hello Friend, Use <%@ page... message to the specified jsp page. For more information, visit hereADS
how to display the email message in jsp
how to display the email message in jsp  hi every one .. i am new from this industry please help me to display the email message in jsp page please send me sample code
error message - Java Beginners
error message  sir, while i m trying to execute my first program(print my name)I get error message like" javac is not recognized as internal or external ...blah..blah..or batch file".even i hav tried setting the path variable
error message - JSP-Servlet
error message  hi, friends after complete my servlet programe i can type http://localhost:8080 on the browser. the servlet program is insert data... device, path, or file you may not have the appropriate permission to access". my
Error Message in Eclipse - Development process
Error Message in Eclipse  Hi Friend, My changes... option is not working in Eclipse. Am getting error message while saving. Now save button is invalid.I forgot that error message. Something like workbench error
struts2 properties file
struts2 properties file  How to set properties file in struts 2 ?   Struts 2 Format Examples Struts 2 Tutorial
Replace JSF Standard Error Message
Replace JSF Standard Error Message  How can we replace the JSF Standard Error Message
To Display the 'Last Modified' message in JSP
To Display the 'Last Modified' message in JSP  I have to display the "Last Modified" auto save message in a portlet page at the right end corner... Modified' Message should be displayed
neo4j-server.properties file location
neo4j-server.properties file location  Hi, Where is the location of neo4j-server.properties file in Linux? Thanks   Hi, Location of neo4j-server.properties file: This file is present in /etc/neo4j directory of linux
XML error message: The reference to entity
XML error message: The reference to entity   XML error message: The reference to entity "ai" must end with the ';' delimiter. Im getting this error when i gotta edit my blogger template Please advice manjunath
Properties file in Java
Properties file in Java       In this section, you will know about the properties file. The properties file is a simple text file. Properties file contains keys and values
Java Properties File Example
the properties file into the program.ADS_TO_REPLACE_2 4. Finally get the text using the key of the properties file. An example of using the properties file... please save the properties file into the c directory of your computer. Here
Java Read username, password and port from properties file
the properties file and display the data from the database. Now to load the data from the properties file, we have used Properties class. This class allowed us to save data...Java Read username, password and port from properties file In this section
Display Errors using Message Resources - Struts
Display Errors using Message Resources  Hello.. I've a login page where i used applicationresources.properties to display errors for null values... required.. I want to display errors using message resources using
Properties File IN Struts - Struts
Properties File IN Struts  Can we break a large property file into small pieces? Suppose we have property file whose size is 64 kb .can we break... the detail along with code and also entry about properties into configuration file
Java error reading from file
Java error reading from file       Java error reading file are the common error occurred  in java that when the user encounter a corrupt file
depending on the form name i have to display the message
on the form name i have to display the message. for example, i have 3 jsp pages... on contact us after entering all details page has to display message like"thank u for contacting us" if user clicks on suugest display message like"thank u
Properties file in Java
Properties file in Java       Properties file in Java In this section, you will know about the properties file. The properties file is a simple text file. Properties
applicationcontext.xml properties file
applicationcontext.xml properties file In this tutorial I will explain how you can use the properties defined in .properties file in your spring application... changing the properties file. Suppose you are developing an email sending
Spring Security Custom Error Message
Spring Security Custom Error Message In this section, you will learn about Custom Error Message in Spring Security. Spring Security have predefined error message, which appears when authentication failed. The predefined error message
Java read properties file
Java read properties file In this section, you will learn how to read properties file. Description of code: There are different tools to access different files. Now to load the data from the properties file, we have used Properties
display repeated lines in a file
display repeated lines in a file  i want a java program that accepts file from user and displays the repeated lines in a file
Display message on scroll Event
Display message on scroll Event In this tutorial, we will discuss about how to display message on scrolling of text area using jQuery scroll event... of it on time, it will display a message. Each time you scroll up/down it will show
xml file display - XML
code to display the above xml file in tree structure where...xml file display   - - - - ADL SCORM CAM 1.3 - - session3 - Online Instructional Strategies that Affect Learner
Struts properties file location - Struts
Struts properties file location  Hi, Where struts properties file stored in web application. I mean which location. Thank u   Hi Friend, The struts.properties file can be locate anywhere on the classpath
Write a program to display grade message according to the marks
Write a program to display grade message according to the marks  pls give d answer how to Write a program to display grade message according to the marks     Write a program to display grade message according
Java Write to properties file
Java Write to properties file In this section, you will learn how to write data to properties file.  The properties file is basically used to store... has provide Properties class to store data into .properties file. It consists
validating credentials and displaying error message in login .jsp if not valid
validating credentials and displaying error message in login .jsp if not valid  hi, i want to validate user name and password against my database table if not valid i have to display error message in my login page.how to do
validating username and password in servlet and redirect to login page with error message if not valid
with error message if not valid  hi i want to validate my login page username and password in my servlet against database and if not valid want to display error message saying "Invalid username and password" in my login page. please help
svg file reading and display
svg file reading and display  i want a sample program for reading and displaying the content of a svg file
code to display 20 record per page and display page 1,2,3,4 as recoerd increase - JSP-Servlet
code to display 20 record per page and display page 1,2,3,4 as recoerd increase  Here is my code i wnat to diplay 15 to 20 records per page please... and previous button or display page no 1,2,3.. this is my code please any one
How to display a file for 24 hours?
How to display a file for 24 hours?  How to display a file for 24 hours
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file in jsp
How to create and use custom error page in jsp
and use custom error page in jsp and display an error message. Before run... How to create and use custom error page in jsp...;  ADS_TO_REPLACE_2     error_page.jspADS_TO_REPLACE_3
Storing properties in XML file
Storing properties in XML file     ... in xml file:- File f=new File("2.xml"):-Creating File in which properties...;} } Xml file in which properties are stored by the program
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST  How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST,please send answer as soo as possible
application cntext file error
application cntext file error  i got an error when execute the file in junit using application context file org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file
display co-occurrence words in a file
display co-occurrence words in a file  how to write java program for counting co occurred words in the file
display co-occurrence words in a file
display co-occurrence words in a file  how to write java program for counting co occurred words in the file

Ads