java - on clicking pass value of anchor tag to another file -


i trying print data database anchor tags , pass value(in rs.getstring(1)) next jsp file(demo.jsp) on clicking it. tried make session , retrieve values it, in file demo.jsp printing last values in database. know because of session being replaced everytime loop runs. able print data in given file, problem occuring pass value demo.jsp. there alternative way of doing this

                    <%                       try                      {    string cars2=request.getparameter("cars"); class.forname("oracle.jdbc.driver.oracledriver"); connection con=drivermanager.getconnection("jdbc:oracle:thin:@amit-pc:1521:xe","system","tiger"); preparedstatement st=con.preparestatement("select thread thread_all car=?");         st.setstring(1,cars2);         resultset rs;         rs=st.executequery();         while(rs.next())         {         %>              <div class="rows">                 <div class="col-lg-12 well">                 <%  session.setattribute("posttopic",rs.getstring(1));   %>                   <a href="demo.jsp">asked :<%out.print(rs.getstring(1));%>                     </a>                     <br>             </div>          </div>     <%         }         }         catch(exception e)         {         }     %> 

try storing data in collection , store collection object in session. display data in next page using collection object.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -