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. really very-2 good site....

thanks

View Tutorial          By: Priti at 2012-02-06 03:00:13

2. Simple file writer example. .............
<

View Tutorial          By: Chezhian TK at 2010-10-14 21:40:16

3. Sir please can you tell me that how can i find occ
View Tutorial          By: Saad at 2013-01-20 11:14:39

4. I have loaded allthe 5 java files.But how to imple
View Tutorial          By: devi at 2008-04-01 01:02:28

5. This Tutorial Rocks!kip it up
View Tutorial          By: Chuck Chalc at 2010-04-22 02:44:11

6. Yes it is exactly same as HTML. No change. In fact
View Tutorial          By: aathishankaran at 2008-08-03 05:22:38

7. I have compiled by keeping all the points in mind
View Tutorial          By: Sweety at 2011-03-09 22:29:18

8. hi RAMLAK i am akankshain and getting these erro
View Tutorial          By: akanksha at 2011-12-06 10:15:47

9. Thank you sir.
View Tutorial          By: Balan at 2008-09-02 22:16:56

10. Hey there, I was needing something exactly like th
View Tutorial          By: Jeffry at 2013-03-26 03:33:27