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>

Recommended Answers

All 3 Replies

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

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" />

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.