Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

changing status code  RSS feed

 
Sharma Anjali
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HF Pg 405

First A:


There are a few limitations though. An included page cannot change the response status code or set headers.


Is this only true for only <jsp:include> or both <jsp:include> and include directive
[ February 22, 2005: Message edited by: Sharma Anjali ]
 
Yogananth
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The restriction you have mentioned is applicable only for <jsp:include>. In this page, current page would be translated & compiled into a seperate servlet and the page that is included would be converted into a seperate servlet. And the seond servlet would be invoked by getting the request dispatcher for that servlet & invoking include method in the dispatcher.

But in the case of "include" directive, both the pages are translated into a single servlet and there will not be any RequestDispatcher call. And thus you can have code that modifies response header or status in either of the pages.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!