这是用于获取用户输入的html jsp代码:
<td><input type="text" value="text" name="newDesc"/></td>
<td>
<a href='adminUpdateService2.jsp?e=<%=request.getParameter("newDesc")%>&d=<%=resultSet.getInt("product_code")%>'>Update</a>
</td>
我期望request.getParameter("newDesc")做的是获取用户在文本字段中输入的值,而是返回值 NULL
这是执行更新过程的java代码:
try{
String x = request.getParameter("d");
int no = Integer.parseInt(x);
String newDesc = request.getParameter("e");
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/weblove_atttirerentals","weblab","");
Statement stmt = conn.createStatement();
stmt.executeUpdate("UPDATE product SET description='"+newDesc+"' where product_code='"+no+"'");
response.sendRedirect("adminShowServices.jsp");
}catch(Exception e){
out.print(e);
}
提前致谢 . 对不起我的英语不好