display error message for dupliacate record in properties file

Ads
 

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

Ads









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
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
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
struts2 properties file
struts2 properties file  How to set properties file in struts 2 ?   Struts 2 Format Examples Struts 2 Tutorial
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
file into the program. 4. Finally get the text using the key of the properties file. An example of using the properties file and changing the caption French...;How to read properties file in Swing Application?" Using Properties files
javascript dom error-message
javascript dom error-message  javascript dom error-message
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
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
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
Replace JSF Standard Error Message
Replace JSF Standard Error Message  How can we replace the JSF Standard Error Message
reading dropdown values from properties file in jsp
reading dropdown values from properties file in jsp  reading dropdown values from properties file in jsp
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
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
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
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
Spring Security Custom Error Message
it with custom error message : The project hierarchy and jar file used is given below...Spring Security Custom Error Message In this section, you will learn about Custom Error Message in Spring Security. Spring Security have predefined error
How to write properties file in java
Write properties file in java In this example we will discuss how to write property file in java. In this example We have write data to properties file. The properties file has fundamentally used to store the data configuration data
How to read properties file in java
How to read properties file in java Description of Example:- In this example... to a stream or load from a stream using the properties file. This properties... read properties file;- ResourceBundle. Properties Class.  
How to display a file for 24 hours?
How to display a file for 24 hours?  How to display a file for 24 hours
use properties file to connect to the database in jsp..
use properties file to connect to the database in jsp..  How to use properties file to connect jsp code with database ..........   Here is a jsp code that connects to database using properties file. <%@page import
How to read properties file in Java?
Example program of reading a properties file and then printing the data... to value. The java.util.Properties class is used to read the properties file. The properties files are simple text file which is saved as .properties
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

Ads