Results 1 to 5 of 5
  1. #1
    vknehra10 is offline Member
    Join Date
    Dec 2016
    Posts
    99
    Rep Power
    0

    Default Why it showing this error

    Java Code:
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
            String name=req.getParameter("name");
            String pass=req.getParameter("password");
            String mail=req.getParameter("mail");
            long cnt=Long.parseLong(req.getParameter("contact"));
            PrintWriter pr=resp.getWriter();
            if(name.equals("pass")&& pass.equals("vivek")){
                RequestDispatcher rd=req.getRequestDispatcher("done.html");          //It showing error in Netbeans why ...can't we add html files
                rd.include(req,resp);
            }
            else{
                pr.print("wrong info");
                RequestDispatcher rd=req.getRequestDispatcher("index.html");        ////It showing error in Netbeans why ...can't we add html files
                rd.forward(req,resp);
            }
    Thanks
    Last edited by Norm; 08-09-2017 at 06:22 PM. Reason: \ changed to / in end code tag

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,942
    Rep Power
    30

    Default Re: Why it showing this error

    Please copy the full text of the error message and paste it here. It has important info about the error.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    vknehra10 is offline Member
    Join Date
    Dec 2016
    Posts
    99
    Rep Power
    0

    Default Re: Why it showing this error

    Quote Originally Posted by Norm View Post
    Please copy the full text of the error message and paste it here. It has important info about the error.


    [code]
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String name=req.getParameter("name");
    String pass=req.getParameter("password");
    String mail=req.getParameter("mail");
    long cnt=Long.parseLong(req.getParameter("contact"));
    PrintWriter pr=resp.getWriter();
    if(name.equals("pass")&& pass.equals("vivek")){
    RequestDispatcher rd=req.getRequestDispatcher("done.html"); // it is showing error in Netbeans ...can't we add html pages
    rd.include(req,resp);
    }
    else{
    pr.print("wrong info");
    RequestDispatcher rd=req.getRequestDispatcher("index.html"); // it is showing error in Netbeans ...can't we add html pages
    rd.forward(req,resp);
    }

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,942
    Rep Power
    30

    Default Re: Why it showing this error

    it is showing error
    Where is the full text of the compiler's error message?
    Please copy the full text of the error message and paste it here. It has important info about the error.

    Also the posted code is missing the ending code tag
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    387
    Rep Power
    4

    Default Re: Why it showing this error

    In the above code you are missing a closing curly bracket and you have to add a forward slash to your address. So something like
    Java Code:
    req.getRequestDispatcher("/index.html").forward(req,resp);

Similar Threads

  1. Error showing up on the programming
    By jjfstar2009 in forum New To Java
    Replies: 10
    Last Post: 04-22-2014, 02:03 AM
  2. Replies: 2
    Last Post: 07-29-2013, 11:16 AM
  3. Replies: 9
    Last Post: 05-28-2013, 09:14 AM
  4. showing error in the pop
    By arun9683 in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 07-02-2010, 10:53 AM
  5. Error Messages Not Showing Up
    By nvidia in forum Web Frameworks
    Replies: 0
    Last Post: 04-07-2008, 10:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •