我正在从数据库中检索数据并将其显示在表格中,JSP但我不知道如何在文本字段中显示它.
例如
JSP我的代码:
public class S2 extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "shoppingCart";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "";
Statement st;
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url + dbName, userName, password);
System.out.println("Connected!");
String pid = request.getParameter("pid");
ArrayList al = null;
ArrayList pid_list = new ArrayList();
String …Run Code Online (Sandbox Code Playgroud)