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. thanks for this example
View Tutorial          By: hai at 2011-12-16 05:36:14

2. java program to maintain the books details like Bo
View Tutorial          By: Prabha at 2013-08-28 12:34:00

3. It's simply nice.
View Tutorial          By: ghani at 2011-07-01 07:18:35

4. My exchange email account is only partially delete
View Tutorial          By: ali at 2010-12-30 02:38:14

5. Can anybody send the full working code for sending
View Tutorial          By: Atul at 2008-11-26 04:47:51

6. Hi,
I want to read the barcode and print it

View Tutorial          By: Santu at 2013-03-12 18:15:18

7. i got really nice help from the code. Thanks.
View Tutorial          By: Amit at 2009-04-10 08:18:40

8. hi, how do i turn it into a gui with swing allowin
View Tutorial          By: psychicjava at 2011-02-06 13:18:08

9. if time out at step 6*** Exception is occure

View Tutorial          By: Bharat at 2011-08-17 10:42:23

10. can i have sample of java programming that has dat
View Tutorial          By: piolo at 2009-05-31 18:53:25