Results 1 to 2 of 2
  1. #1
    hei1233212000 is offline Member
    Join Date
    Jul 2010
    Rep Power

    Default Question about RequestDispatcher

    Hi all, I am a green hand.
    Now, I am facing a problem using include() of RequestDispatcher. The below is the part of my servlet code

    in doPost
    Java Code:
    request.setAttribute("list", bean.viewAll()); // set the list
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(toPage);
    writer.println("<script>alert('plan_no = " + planNo + " is added');</script>");
    where bean.viewAll() return a List object

    I got no exception and error but a bug!!
    I expect a alert will popup but it doesn't, and the worst thing is the web page only show the html code instead of the GUI.

    And, I have tried to use "forward()" instead of "include()" that it really can solve the problem, however, I need the alert message.
    Furthermore, I have also tried to remove the code
    Java Code:
    request.setAttribute("list", bean.viewAll());
    Then, it also can solve the problem. Again, I need the "list"....

    What' wrong with my code? Please give me a hand.
    Thank you

  2. #2
    hei1233212000 is offline Member
    Join Date
    Jul 2010
    Rep Power

Similar Threads

  1. What exactly is this question asking?
    By kmjt in forum New To Java
    Replies: 2
    Last Post: 01-27-2011, 05:01 PM
  2. Question concerning question marks and colons
    By jim01 in forum New To Java
    Replies: 17
    Last Post: 01-14-2011, 01:05 AM
  3. Question mark colon operator question
    By orchid in forum Advanced Java
    Replies: 9
    Last Post: 12-19-2010, 09:49 AM
  4. question
    By sunilgamidi in forum Introductions
    Replies: 0
    Last Post: 09-28-2010, 09:23 AM
  5. Replies: 5
    Last Post: 07-29-2008, 03:13 PM

Posting Permissions

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