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

Problem with precompiling my JSP pages.  RSS feed

 
John Ip
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I am using JSP 1.2, and I developed my own custom tag library. I have written the tld file and package them in a jar file.

META-INF/mytaglib.tld
mytaglib/Mytag.class

I put the jar file in the WEB-INF\lib directory and I also copy the tld file in the WEB-INF directory.

However, when I include a tag in my library in one of my jsp page. I have the following error:

[jasperc] java.lang.NoClassDefFoundError: mytaglib/Mytag (wrong name: MyTag)

I use an ant script task jaspc to do the job. Can anyone help me to find out the cause of the error.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[jasperc] java.lang.NoClassDefFoundError: mytaglib/Mytag (wrong name: MyTag)


Is your casing consistent everywhere? Mytag is not the same as MyTag.

Btw, there's no need to extract the tld file from the jar.
 
John Ip
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, that is my typo error in the message.

The error is

java.lang.NoClassDefFoundError: mytaglib/MyTag (wrong name: MyTag)

does anyone have a clue how to fix this problem?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's your tld entry for the tag look like?
 
John Ip
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I have in my tld file

<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version></jsp-version>
<short-name>m</short-name>
<uri></uri>
<tag> <name>myTag</name>
<tag-class>mytaglib.MyTag</tag-class>
<body-content>empty</body-content>
</tag>
</taglib>

And in my jsp file

<%@ taglib uri="/WEB-INF/mytaglib.tld" prefix="mytaglib"%>

<mytaglib:myTag />

Thank you!
 
John Ip
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have typo again

I should have 1.2 in between the <jsp-version> tags

sorry about that.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!