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. not that much clear exampl.. you should explain it
View Tutorial          By: elangovan at 2010-06-09 02:36:19

2. this code is running successfully
View Tutorial          By: Amit Agarwal at 2013-03-08 10:56:39

3. Hi, i am newly in java,please send me on sample pr
View Tutorial          By: aruna.k at 2012-12-13 06:05:44

4. Thanks for this article.
View Tutorial          By: Arindam Dey at 2011-06-16 05:23:17

5. I copied the same program for execution...

View Tutorial          By: Anusha at 2014-05-14 14:24:19

6. Hi Shiva,
Comparator interface is used to o

View Tutorial          By: Srinath at 2015-04-19 08:23:20

7. Thanks , really appreciate
View Tutorial          By: Marlen at 2010-11-23 10:50:29

8. Real Life example of using Volatile
*******

View Tutorial          By: Mayank at 2011-01-25 15:44:21

9. Good work, IT really help me a lot;
View Tutorial          By: TUSHAR at 2010-02-03 01:25:37

10. Sat Apr 23 10:44:14 IST 2011:Sender:*** time out a
View Tutorial          By: sasivarnan at 2011-04-23 01:17:18