Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDisptacher include() and forward()

 
Hung Tang
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a question:
I have two servlets and one jsp; they are:
ControlServlet
IncludeServlet
forward.jsp
ControlServlet will use dispatcher.include("IncludeServlet"). IncludeServlet stores a string object by way of request.setAttribute("key", "value"); ControlServlet regains control again and use dispatcher.forward("/forward.jsp").
My question is, is the string object is still stored in the request object when control is passed to forward.jsp? What i mean is, can forward.jsp use <%= request.getAttribute("key") %> and expect to see "value" on its page?
Thanks
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic