Comment on Tutorial - Handling multiple buttons in HTML Form in Struts By Charles



Comment Added by : karthick

Comment Added at : 2008-08-30 03:09:42

Comment on Tutorial : Handling multiple buttons in HTML Form in Struts By Charles
hello sir

i am simulating railway reservations system using servlets technology.

i m using HTML client and JAVA server

i have multiple submit buttons in a single form in my HTML script

how to retrieve the values in my form into the java file

my server code is :

public class insert_into_DB extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)throws
IOException,ServletException
{
Connection con;
Statement s;
ResultSet rs;


/* I NEED MY VALUES IMPORTED FROM HTML FILE HERE */


res.setContentType("text/html");
PrintWriter out=res.getWriter();
try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:civilsupp");
s=con.createStatement();
String str="insert into shop values("+s1+",'"+s2+"',"+s3+","+s4+","+s5+")";
s.executeUpdate(str);
out.println("<html>");
out.println("<center><br><br><h3>ADDED<br><br>");
out.println("</html>");
con.close();
}
catch(Exception e)
{
out.println(e);
}
}
}

*********** THANK YOU *************


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. @Prab, no its 7 since it starts the counting at 0
View Tutorial          By: Shadowfaux at 2009-11-21 15:22:49

2. easy to understand and it helped me a lot in prepa
View Tutorial          By: shandini at 2011-04-14 13:14:33

3. Hi I need code examples J2ME for chating aplicatio
View Tutorial          By: agus at 2010-04-03 04:16:11

4. hi every body i want full java code to send messag
View Tutorial          By: Ashray P Shetty at 2010-11-09 04:33:45

5. can i get some basic examples of java program
View Tutorial          By: raja at 2013-06-04 10:47:12

6. when i tried this code i couldnt run the program..
View Tutorial          By: kavitha at 2009-11-28 01:38:55

7. nice example!!
View Tutorial          By: gayathri subramanian at 2010-08-18 09:27:59

8. what if i use multiple switch statement, is it wor
View Tutorial          By: earl at 2012-01-29 04:10:25

9. Is it possible to create a Reader class without lo
View Tutorial          By: bs at 2010-10-11 05:42:34

10. Hi i changed some codes in that and i gave interne
View Tutorial          By: Göktuğ ÖZEL at 2013-03-13 22:44:55