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. Thank you......... It's very helpful.
View Tutorial          By: Ramesh Kumar Mahto at 2010-09-01 12:12:30

2. I want get data from Mysql into Spinner by using P
View Tutorial          By: Dilsha at 2013-07-06 05:17:58

3. Legend. Worked first time!
View Tutorial          By: Luke at 2014-12-19 10:10:00

4. Does Wait() inside synchronized create a race cond
View Tutorial          By: Aviator168 at 2010-04-21 16:02:06

5. it is a good example to understand.
View Tutorial          By: nivedha at 2011-07-12 05:15:39

6. thanx a lot.............!!!! u r best..........
View Tutorial          By: Pratik at 2010-04-12 12:41:30

7. nice one
View Tutorial          By: navyasri at 2012-05-02 04:41:10

8. What is meant by source code portability?
View Tutorial          By: sathihs at 2012-11-02 11:16:57

9. Hi i have studied these programs.
but unabl

View Tutorial          By: Karuna at 2008-03-30 08:46:00

10. Very new to Java and was hoping you could explain
View Tutorial          By: Confused at 2011-08-16 14:02:06