Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

directive vs scriptlet? element?  RSS feed

 
Ashimashi Kabashi
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers

when should one use a script over a directive or vice versa.

i.e. <%@ include page="abcd.jsp" %>
over <jsp:include page="abcd.jsp" %>
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is one reason.

In one of my apps I had includes for a header and a footer, both using jsp:include. Worked fine, until I started using JMeter to load test the app. Then I started to get an IllegalStateException on the include of the footer with the text "Cannot create a session after the response has been committed". I changed the footer to "@ include" and all was well. (If I would not have been lazy I might have looked to see if there was a buffer size being set somewhere which might have caused this behavior.)

Note that this happened a few years ago. I still know about it, including the text of the error message, because I have a 4-line comment immediately before the "@ include" explaining exactly why I am using it and not jsp:include. In other words, most of the prior paragraph came from that comment.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!