java ee - Glassfish realm login redirects to wrong page -


here form in index.jsp page called:

<form action="log_in" method="post">                 <table>                     <tr>                     <td>                         <select name="user_type">                             <option value="doctor">doctor</option>                             <option value="pharm">pharm</option>                             <option value="micro">micro</option>                             <option value="pat">pat</option>                             <option value="admin">admin</option>                         </select>                             </td>                         </tr>                 </table>                  <p><input type="submit" value="enter" ></p>                  </form> 

here's servlet , post method:

@override protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { .......................................     else if (userpath.equals("/log_in")) {            type = request.getparameter("user_type");                if("doctor".equals(type))           {              userpath = "/doc_index";             }                  else if ("pharm".equals(type))           {                      userpath = "/pharm";            }              else if ("micro".equals(type))           {                     userpath = "/micro";             }             else if ("pat".equals(type))           {                     userpath = "/patient";             }            else if ("admin".equals(type))           {                     userpath = "/admin";             }   }  if (!userpath.equalsignorecase("/index.jsp"))          {               url = "/web-inf/view" + userpath + ".jsp";          }           else          {              url = "index.jsp";          }         try     {        request.getrequestdispatcher(url).forward(request, response);     }      catch (exception ex) {         ex.printstacktrace();      }  } 

all pages except index.jsp, login.jsp, loginerror.html in /web-inf/view/.... folder. want redirect different page based selection in form. when call post method login triggered redirects in log_in page doesn't exist! when go in browser , try redirect each page transferred correctly. doing wrong?

edit: log_in method have written takes starting page of each user(doctor,pharm,micro,patient..). not realm authentication method. when run method actual login presents , asks me credentials. problem when write credentials instead of taking me doc_index.jsp page takes me log_in.jsp page doesn't exists. it's doesnt pass through servlet , log_in method reason, because when go in browser after log in transferred correctly doc_index.jsp...


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -