Results 1 to 2 of 2
Thread: Question about RequestDispatcher
- 04-09-2011, 05:36 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 36
- Rep Power
- 0
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
where bean.viewAll() return a List objectJava Code:request.setAttribute("list", bean.viewAll()); // set the list RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(toPage); dispatcher.include(request,response); response.setContentType("text/html"); writer.println("<script>alert('plan_no = " + planNo + " is added');</script>");
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
Then, it also can solve the problem. Again, I need the "list"....Java Code:request.setAttribute("list", bean.viewAll());
What' wrong with my code? Please give me a hand.
Thank you
- 04-10-2011, 07:32 AM #2
Member
- Join Date
- Jul 2010
- Posts
- 36
- Rep Power
- 0
Similar Threads
-
What exactly is this question asking?
By kmjt in forum New To JavaReplies: 2Last Post: 01-27-2011, 04:01 PM -
Question concerning question marks and colons
By jim01 in forum New To JavaReplies: 17Last Post: 01-14-2011, 12:05 AM -
Question mark colon operator question
By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 08:49 AM -
question
By sunilgamidi in forum IntroductionsReplies: 0Last Post: 09-28-2010, 08:23 AM -
<jsp:include> Vs <%@include> Vs <jsp:forward> Vs RequestDispatcher .forward/includeVs
By freddieMaize in forum Java ServletReplies: 5Last Post: 07-29-2008, 02:13 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks