Click here to Skip to main content
15,894,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 5-Jul-17 0:16am

1 solution

You must introduce a variable with a higher scope. Like a class member (prefered) or a global storage like an list of values. Store as cookie possible?

It need some architectural considerations to find the best place.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900