• Post Reply Bookmark Topic Watch Topic
  • New Topic

what can be in a tag body?  RSS feed

 
Michael Moeller
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

currently I'm working the "Head First Servlets and JSP" over, and this book is really great stuff!

But after reading the chapters 9 "Custom tags are powerful" and 10 "When even JSTL is not enough..." I'm a little confused about what can be in a tag body.

In chapter 9 they say the <body-content> element can be JSP by what "the tag body can have anything that can go inside a JSP".

In chapter 10 they say "The crucial thing you must remember about JspFragment is that it must NOT contain any scripting elements!".

But the body of a tag that invokes a simple tag handler is encapsulated in the JspFragment object and sent to the tag handler in the setJspBody() method.

This strikes me as inconsistent. What's the crucial point?
 
Tha�s Manfrim Firmino
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I understand...
In chapter 10 they say "The crucial thing you must remember about JspFragment is that it must NOT contain any scripting elements!".
they are talking about .jspf files.
 
Michael Moeller
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assumed that the .jspf extension is used as a programming practice to differentiate source files of complete JSP pages (.jsp) and source files of JSP segments (.jspf) that need not be legal JSP pages since they are statically included.

The API says: "The definition of the JSP fragment must only contain template text and JSP action elements. In other words, it must not contain scriptlets or scriptlet expressions."

It is assumed that <body-content>JSP</body-content> is allowed in the TLD if you don't forget that the tag body must not contain scriptlets or expressions.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Moeller:
I assumed that the .jspf extension is used as a programming practice to differentiate source files of complete JSP pages (.jsp) and source files of JSP segments (.jspf) that need not be legal JSP pages since they are statically included.


This is correct.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!