tejasri
java
1 Answer(s)      4 years and 7 months ago
Posted in : Java Beginners

the values which are in the data table of database test.now i got the values are displaying on the jsp page but the values are displaying many times please help me in this regard i will give u the code which i have written and please refer the corrections and send me as soon as possible please help me iam waiting for ur reply. <%

Class.forName("org.gjt.mm.mysql.Driver"); System.out.println("Driver class is loaded..."); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/contract","root",""); System.out.println("Connection is established....");
System.out.println("PreparedStatement object is created...");

     Statement statement=null;

try { statement=connection.createStatement(); statement.execute("Select dstsignatory,designation from tbl_generalinformation"); ResultSet resset = statement.getResultSet(); while(resset.next()) {%> DST Signatory: <%=resset.getString("dstsignatory")%> Designation: <%=resset.getString("designation")%>

        <% }
         resset.close();

    }
     catch (SQLException e)
     {
          e.printStackTrace();


     }
     finally
     {
         if(statement!=null)
         {
             try
             {
                statement.close();
             }
             catch (SQLException e)
             {
                 e.printStackTrace();


             }
         }
         if(connection != null)
         {
             try
             {
                connection.close();
             }
             catch (SQLException e)
             {
                 e.printStackTrace();

             }
         }
     }

%>

here my database is Contract and my table name is tbl_generalinformation lease help me soon. thanks for ur replys

Advertisement
View Answers

February 2, 2011 at 1:11 PM


Hi Friend,

If u want to display the whole record from the database then use table tag as we have provides u and if u want to display one record then u have to edit the query i.e, u have to use the where clause in select query, whose record do u want to display.

For more information,

Visit Here

Thanks










Related Tutorials/Questions & Answers:
java
java  diff bt core java and java
java
java  what is java
Advertisements
Java
Java   Whether Java is pure object oriented Language
java
java  different between java & core java
java
java  explain technologies are used in java now days and structure java
java
java   why iterator in java if we for loop
JAVA
JAVA  how the name came for java language as "JAVA
java
java  what is java reflection
java
java  is java open source
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
java  write a java program using filenotfoundexception
Java
Java  how to draw class diagrams in java
java
java   difference between class and interface
java
java  why multiple inheritance is not possible in java
java
java  explain object oriented concept in java
java
java  is java purely object oriented language
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  what are JAVA applications development tools
java
java  how use java method
java
java  send me java interview questions
java
java  write a program in java to acess the email
java
java  Write a java code to print "ABABBABCABABBA
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
Java
Java  how to do java in command prompt
java
java  Does java allows multiline comments