0

I am using microsoft access as my database.
When i click on the button Enter Details nothing happen.
Please suggest where the mistake is.
The doGet method contains the following code

super.doGet(request, response);
		String Name = request.getParameter("txtName");
		String Designation = request.getParameter("txtDesignation");
		Connection con = null;
		PreparedStatement pstmt = null;
		try {
		Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		con = DriverManager.getConnection("jdbc:odbc:student_base");
		pstmt = con.prepareStatement("Insert into student_base(Name, Designation) values(?,?)");
		pstmt.setString(1, Name);
		pstmt.setString(2, Designation);
		pstmt.executeUpdate();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		finally {
		try {
			pstmt.close();
			con.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		}

where as my jsp page contains the following

<body>
<form action="http://localhost:8080/ConnectingAccess/AddDetails.jsp" method="get">
<h3>This page add details in access database</h3>
<hr/>
Name: <input type="text" name="txtName" />
Designation: <input type="text" name="txtDesignation" />
<hr/>
<input type="button" name="btnEnter" value="Enter Details" />
</form>
</body>
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by javaAddict
0

The doGet method inside witch file/class it is? Because the action in your jsp form must submit to that file.

0

Hey Rahul.......

The button you have created does not contain any external resources or does not process any requests....

I think just update the <input button....> tag line like :

<input type="submit" name="btnEnter" value="Enter Details" />

0

Hey Rahul.......

The button you have created does not contain any external resources or does not process any requests....

I think just update the <input button....> tag line like :

<input type="submit" name="btnEnter" value="Enter Details" />

Oups. I missed that.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.