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. well,its better to teach with video how it works
View Tutorial          By: c.muthukumar at 2010-09-22 07:28:24

2. super explination.
View Tutorial          By: nagarjun reddy at 2013-01-19 13:55:16

3. Please note that the above code does not work with
View Tutorial          By: mk at 2012-02-15 10:59:49

4. it's very helpful for java beginner. thanks
View Tutorial          By: Pisal at 2012-12-03 05:00:54

5. Please send me the multithreading chat application
View Tutorial          By: Vaibhav at 2010-06-23 23:58:43

6. Thank you for a great explanation now I'm in the l
View Tutorial          By: C++Noob at 2011-12-22 04:43:31

7. I love http://www.java-samples.com very much , I w
View Tutorial          By: Phongveth at 2009-03-13 13:15:04

8. I want to say, that you have to give complete code
View Tutorial          By: Jasvir Yadav at 2009-09-05 07:23:15

9. Thanks a lot!!!.Quite helpful article.
keep

View Tutorial          By: Raj at 2008-03-14 03:59:56

10. It's a good eg to learn join and isAlive method.Bu
View Tutorial          By: Nithin at 2012-02-02 08:43:28