4 Replies Latest reply on Apr 16, 2008 12:42 PM by 807601

    Illigal argument Exception

    807601
      Hi to all,

      I am writting this code.in a servlet.

                if(name.equals(st) && password.equals(pw))
                {
                RequestDispatcher dispatcher=getServletContext().getRequestDispatcher("abc.html");
                dispatcher.forward(rq,rs);
                }
                else
                {
                RequestDispatcher dispatcher1=getServletContext().getRequestDispatcher("def.html");
                dispatcher1.forward(rq,rs);
                }
      But,this giving stacktrace as


      java.lang.IllegalArgumentException: Path def.html does not start with a "/" character
           at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:378)
           at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:194)
           at displayserv.doGet(displayserv.java:42)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
           at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
           at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
           at java.lang.Thread.run(Unknown Source)
      Exception occured


      Exception.Please give me a solution.
      Thanq.