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



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. some more examples should be given...
View Tutorial          By: flora at 2010-12-08 03:32:50

2. Hi, You need to place a control on your form

View Tutorial          By: Ranjit at 2010-02-09 02:29:40

3. very easy way for understanding the java programmi
View Tutorial          By: praveen chandrakar at 2010-10-14 20:26:53

4. nice material
View Tutorial          By: ravi at 2008-12-24 00:40:12

5. this code is not working properly buddies. please
View Tutorial          By: hammad at 2011-06-10 01:53:39

6. The program will work only need to change

View Tutorial          By: LEENA NARULA at 2012-06-15 06:45:06

7. hey pls tel me, what is the advantage of method ov
View Tutorial          By: divya at 2013-08-27 14:20:22

8. Hey this code is very helpful......can you please
View Tutorial          By: Preetam Purbia at 2010-03-01 04:25:47

9. whoo... its very hard
View Tutorial          By: Anonymous at 2009-01-13 20:17:20

10. Thx for the explanation, I understand what recursi
View Tutorial          By: Tina at 2008-12-15 16:39:27