RequestDispatcher method is not working.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sumanta123
    New Member
    • Dec 2008
    • 34

    RequestDispatcher method is not working.

    Dear Sir,
    I am calling procedure in my servlet program.The procedure returns correct valule.

    For example

    If the Logid id wrong then errorType Returns E and errorDesc LOGIN ID IS NOT AVAILABLE.
    i am set this error message request.setAttr ibute("errorLog in", "Invalid Login ID") and forward to /help/NewPassword.jsp


    If the Date of Birth wrong then errorType Returns E and errorDesc DOB IS NOT AVAILABLE.
    i am set this error message request.setAttr ibute("errorDob ", "Invalid Date of Birth") and forward to /help/NewPassword.jsp


    I am getting proper return type from procedure.This server log.
    [16/Jan/2009:19:20:56] info ( 3972): CORE3282: stdout: errorType...->E
    [16/Jan/2009:19:20:56] info ( 3972): CORE3282: stdout: errorDesc...->ERROR::DOB IS NOT AVAILABLE
    But while forwarding same errormsg to jsp using the syntax it is not forwarded to jsp.No exception comming.But help/NewPassword.jsp this also exist.The blank is comming.
    request.setAttr ibute("errorDob ", "Invalid Date of Birth");
    strJspCalled =response.encod eRedirectURL("/help/NewPassword.jsp ");
    The code is given below.Could you please rectify my code/guide me for the needful.

    Code:
     
           try
             {
                       HashMap values = new HashMap();
                       String procString="PR_ITS_CUSTOMER_AUTH (?,?,?,?)";
                       values.put("1",userid);
                       values.put("2",dateofbirth);
                       values.put("3","Types.VARCHAR");
                       values.put("4","Types.VARCHAR");
                        HashMap out = new HashMap();
                         strRespLogin ="You have entered wrong existing login password.";
                         dbCon = new OracleDbConnector(ConnectionPool.interactiveConnectionPool);
                        if(dbCon!=null)
                       {
                         out = dbCon.CallStatementForProc(procString,values);
                        
                         if(out!=null)
                         {
                             errorType = out.get("3").toString();
                             errorDesc = out.get("4").toString();
                                                    
                           
                            }
                      
                        
                       }
                        
                       if(errorType.equals("E"))
                       {
                        if (errorDesc.equals("LOGIN ID IS NOT AVAILABLE")){
                            request.setAttribute("errorLogin", "Invalid Login ID");
                            strJspCalled =response.encodeRedirectURL("/help/NewPassword.jsp");
                            RequestDispatcher dispatcher=request.getRequestDispatcher(strJspCalled);
                            dispatcher.forward(request,response);
                            return;
                        }
                        else if (errorDesc.equals("DOB IS NOT AVAILABLE")){
                             request.setAttribute("errorDob", "Invalid Date of Birth");
                             strJspCalled =response.encodeRedirectURL("/help/NewPassword.jsp");
                             RequestDispatcher dispatcher=request.getRequestDispatcher(strJspCalled);
                             dispatcher.forward(request,response);
                             return;
                         }
                         
                       }  
           }catch (Exception e) 
             {
            e.printStackTrace();
              
             }
    Thanks and Regards
    Sumanta Panda
  • sumanta123
    New Member
    • Dec 2008
    • 34

    #2
    Dear All,
    i request you to all please advise me for the above needful.

    Regards
    Sumanta Panda

    Comment

    Working...