(HFSJ PAge 512 - Topic "What exactly is a JspFragment)
This section in book makes a comment "there must NOT be any scripting elements in JspFragment, it can contain template text, standard and custom actions, EL but NO scriptlets, declaration or scripting expression. "
However is in't it true we could use scripting elements inside the body ? How does the above statment hold true against following ?
<c:forEach var="myitem" items="myList"> <%="I am scripting expression " %> </c:forEach>
"FastGoogly", we don't have many rules around here but our naming policy is one of them. Not complying with the policy will lead to your account becoming locked. This warning hopefully will prevent that from happening, but some action is required on your part.
Please review the policy here and you can change your Publicly Displayed Name here.
A good workman is known by his tools.
posted 14 years ago
Salil, I am not sure the example explains why you can't have scriptlets in a JspFragment. I did a little bit more digging. As per JSP 2.0 specification
"A translation error must occur if a piece of JSP code that is to be translatedinto a JSP Fragment contains scriptlets or scriptlet expressions."
A SimpleTagSupport uses JspFragment, hence body of a simple tag can not contain scripting.. By that extension body-content for SimpleTag's can not be "JSP", only allowed values are "scriptless", "emptly", "tagdependent".
If I specify the body-content as "JSP" in TLD for a SimpleTagSupport, you will get an error.
Similarly you can not use scripting inside body of a "Tag File".
However a classic tag implemented with BodyTagSupport can contain "scripting " in its body. That is why you are able to include the scripting in standard actions.
Standard action allows scriting to be used in its body.