问题描述
JSP代码:
<%
String aref = request.getParameter( ArR);
尝试{
Class.forName(com.mysql.jdbc.Driver);
java.sql。 Connection con = DriverManager.getConnection(jdbc:mysql:// localhost:3306 / airproject,root,
root);
ResultSet rs;
语句st = con.createStatement();
System.out.println(插入演示值('+ aref +'));
st.executeUpdate(插入演示值('+ aref +'));
System.out.println(保存记录);
} catch(ClassNotFoundException e){
e.printStackTrace();
} catch(SQLException e){
e。 printStackTrace();
}
session.setAttribute(结果,注册成功);
response.sendRedirect(menu0。 jsp);
%>
HTML代码:
注册
这些代码在后端存储时没有问题。但是当它返回以形成我输入的值时,它应该保留。
提前谢谢
我尝试过:
JSP代码:
<%
String aref = request.getParameter(ArR);
try {
Class.forName(com.mysql.jdbc.Driver);
java.sql.Connection con = DriverManager.getConnection(jdbc:mysql:// localhost:3306 / airproject, root,
root);
ResultSet rs;
语句st = con.createStatement();
System.out.println(插入演示值('+ aref +'));
st.executeUpdate(插入演示值('+ aref + '));
System.out.println(保存记录);
} catch(ClassNotFoundException e){
e。 printStackTrace();
} catch(SQLException e){
e.printStackTrace();
}
s ession.setAttribute(结果,注册成功);
response.sendRedirect(menu0.jsp);
%>
HTML代码:
注册
这些代码在后端存储时没有问题。但当它返回以形成我输入的值时,它应该保留。
提前谢谢
JSP Code:
<%
String aref = request.getParameter("ArR");
try {
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/airproject", "root",
"root");
ResultSet rs;
Statement st = con.createStatement();
System.out.println("insert into demo values('" + aref + "')");
st.executeUpdate("insert into demo values('" + aref + "')");
System.out.println("Record Saved");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
session.setAttribute("Result", "Registered successfully");
response.sendRedirect("menu0.jsp");
%>
HTML Code:
Registration
These code don't have problem in storing in the back-end. But when it return to back to form the value what i have enter, it should retain.
Thanks in advance
What I have tried:
JSP Code:
<%
String aref = request.getParameter("ArR");
try {
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/airproject", "root",
"root");
ResultSet rs;
Statement st = con.createStatement();
System.out.println("insert into demo values('" + aref + "')");
st.executeUpdate("insert into demo values('" + aref + "')");
System.out.println("Record Saved");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
session.setAttribute("Result", "Registered successfully");
response.sendRedirect("menu0.jsp");
%>
HTML Code:
Registration
These code don't have problem in storing in the back-end. But when it return to back to form the value what i have enter, it should retain.
Thanks in advance
推荐答案
这篇关于即使在后端存储数据后仍保留文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!