Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A doubt about tag without body content  RSS feed

 
Parthiban Malayandi
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I learned from "HeadFirst servlets and JSP" that if the tag is
declared as it doesn't allow body content then it's legal to
just put just open tag and end tag (nothing in between) (from chapter 9)

I tried a simple program to understand that but it doesn't
work as I expected rather it throws a expection

Here's the snippet of the exception :
=======================

org.apache.jasper.JasperException: /Tagwithoutbody.jsp(9,0) According to TLD, tag my:mytag must be empty, but is not

Following is the simple program which I tried

JSP which uses custom tag
=========================



Tag Handler
===========



TLD
====



is there any mistake I commited ?
Please clarify me.

Thanks in advance.
 
Albareto McKenzie
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take care that there is nothing inside, this:

<my:mytag>
</my:mytag>

is not the same as this:

<my:mytag></my:mytag>

and not the same as this:

<my:mytag> </my:mytag>

a blank space is a character. You can also put this <my:mytag /> for tags without body.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly correct. The tag:

is not empty.
 
Parthiban Malayandi
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Albareto and Bear Bibeault ,

Thanks for your replies which helped me to know a subtle point . I may expect this type of subtle questions in exam . once again thanks for your replies which saved me.Lastly sorry for my delayed response .

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!