I have a jsp in which there is a textbox.
After posting the data I want to do a redirection and then want this textbox to be populated with the string in ADD
(plz refer the below code) in page 1,
the problem I'm facing is that there is a query in first page which is making this textbox empty.
I heard that I can make use of QueryString() or please suggest me any other process if available, but I'm not sure of how to use it. The redirection code is as below.
<%
try {
ResultSet rs = null;
String Add = request.getParameter("Allocation"); // this is the string
String user = (String) session.getAttribute("myusername");
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Date d1 = new Date();
String d1_str = new SimpleDateFormat("yyyy-MM-dd").format(d1);
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
PreparedStatement ps = con.prepareStatement("UPDATE SCOPE1 SET ALLOCATED='"+d1_str+"', SPECIALIST='"+user+"' WHERE DBID='"+Add+"'");
con.setAutoCommit(true);
int i = ps.executeUpdate();
if(i!=1) {
String s = "Users.jsp?tgt1 = " + Add + ""; // I wanted to know what should go here
response.sendRedirect(s);
}
else {
out.println("err");
}
}
catch(Exception e) {
out.println(e);
}
%>
and the name of my text box is tgt1
in page 1.
Thanks