Forums Register Login

body-content JSP not working

+Pie Number of slices to send: Send
I have a TLD file under WEB-INF folder

The content of tld is





And I have a jsp pages with content




When I tried this code the first tag content with text works on the other hand the second tag gives exception like below... I would like to use any JSP in my tag body!!


org.apache.jasper.JasperException: /jsppages/tagsuse.jsp(27,1) The TLD for the class com.tt.taghandlers.SimpleExWithBody specifies an invalid body-content (JSP) for a SimpleTag.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch

[ December 18, 2008: Message edited by: Anut Walidera ]
[ December 18, 2008: Message edited by: Anut Walidera ]
+Pie Number of slices to send: Send
Hi,

as the error message says, you cannot include scripting code in the body of a SimpleTag. This is the reason why the following line in the TLD is not valid:

<body-content>JSP</body-content>

If you really need to use scripting code, then you should go for the Classic Tag (by implementing the javax.servlet.jsp.tagext.Tag interface).
+Pie Number of slices to send: Send
You can't use scripting inside the tag's body for SimpleTag implementations, basically this is because the body of a Simple Tag Handler is represented by JspFragment which does not support scriplets, therefore the <body-content> may not be "JSP"

Here are a few resources to help you understand why:
https://coderanch.com/t/92972/java/SimpleTag-body-content
http://www.orionserver.com/docs/tutorials/taglibs/16.html#what
+Pie Number of slices to send: Send
Thanks for your valuable explanations
I got it...


You can thank my dental hygienist for my untimely aliveness. So tiny:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3393 times.
Similar Threads
Doubt on nested tags
Trying to use custom actions in jsp - unexpected output
Tomcat 5.028 not able load tag handler class
A tag can call its parent
taglib problem in Netbeans
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:14:22.