jdbc - RequestDispatcher to a jsp or servlet -


parameters[username, userpw] sent user through home.jsp. these parameters matched in login servlet against stored userinfo db using jdbc.

in dopost method using if condition tfor authentication follows

if (rs.next()) {             string refname = rs.getstring("username");              string refpass = rs.getstring("userpw");              if (user.equals(refname) && pw.equals(refpass)) {                  out.println("<br>you in");                  requestdispatcher dispatch= getrequestdispatcher("/searchfriend.jsp");                 dispatch.forward(req, resp);                  system.out.println("sucess");              } 

when authentication successfull, how can direct user new jsp or servlet can input few textboxes , select-options select few records db table. not clear me how can direct page search.jsp page in above if condition. search.jsp in webcontent folder of juno.

i using jdbc tomcat7. please help

it not clear , requirement , trying achieve looking code have posted.kindly reframe question

according assumption , need redirect user home page when authentication successful.

if so, can store user credential in session making custom filter sessionfilter implements filter

httpsession session = request.getsession(); 

store credenials in session , if authentication successful redirect using :

requestdispatcher view = request.getrequestdispatcher(/home.jsp); view.forward(req,resp); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -