How to insert jsp testbox values in sql database in button click
plz help

Recommended Answers

Submit the page to a servlet or a jsp, take the value of the testbox from the request, call a method with the value as argument, that method should have code that inserts in the database, redirect to whatever page you want, or stay at the same jsp.

Jump to Post

All 2 Replies

Submit the page to a servlet or a jsp, take the value of the testbox from the request, call a method with the value as argument, that method should have code that inserts in the database, redirect to whatever page you want, or stay at the same jsp.

JSP Code

<input type="text" name="someData" id="someData" />

Servlet Code

String strSomeData=request.getParameter("someData");
 dataManager.getConnection();
 dataManager.getUserData(strSomeData);

connection method

public void getConnection()
{
   // Connection coding
}
public void getUserData(String strSomeData)
{
   // insert query 
}
Be a part of the DaniWeb community

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