Sending of variables between jsp pages using url -


i passing variable value via url jsp page, when run system.out.println on 2nd jsp page check variable value, null.

any appreciated.

the codes below snippets of original program make less wordy.

testsend.jsp

<%@ page import ="java.sql.*" %>   <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body>     <!-- prints out table header  -->     <table border="1">     <tr>     <td>title</td>     </tr> <%  preparedstatement pstmt;  pstmt = conn.preparestatement("select * tadot");  resultset rs = pstmt.executequery();  while(rs.next()){      out.println("<form action ='testsend.jsp' method='post'");     out.println("<tr>");     out.println("<td>" + rs.getstring("title") + "</td>");     out.println("<td> <input type='hidden' name='hidden' value='"+rs.getstring("title")+"'> <input type='submit' name='editm' value='edit'>  </td>");     out.println("</tr>");     out.println("</form>");     }  string ed="";  // check if edit button clicked if(request.getparameter("editm") != null) {     string getmov3 = request.getparameter("hidden");     // debug - prints out value correctly     system.out.println("testsend.jsp"+getmov3);     ed = getmov3;     // debug - prints out value correctly     system.out.println(ed);  // passes variable ed testrec.jsp     response.sendredirect("testrec.jsp?ed"+ed);  }  %>   </table>  </body> </html> 

testrec.jsp

<%@ page language="java" contenttype="text/html; charset=iso-8859-1"     pageencoding="iso-8859-1"%>         <%@ page import ="java.sql.*" %>  <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body>  <%      string getmov2 = request.getparameter("ed");     // debug - null value printed. error.     system.out.println("testrec.jsp"+getmov2);  %> </body> </html> 

it looks missed "="

response.sendredirect("testrec.jsp?ed="+ed); 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -