This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom tags Problem

 
saravana.T kumar
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
I am having an error with tomcat which says
=>
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 11 in the jsp file: /hi.jsp
test2 cannot be resolved to a type
8:
9: <%@ taglib prefix="my" uri="dog" %>
10:
11: <my:dimple/>
12:
13: </body>
14:
---------------------------------------------------------------------------
My TLD file (simple.tld) is(placed in /web-inf dir)

<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">

<tlib-version>1.2</tlib-version>
<short-name>java</short-name>
<uri>dog</uri>
<tag>
<name>dimple</name>
<tag-class>test2</tag-class>
<body-content>scriptless</body-content>
</tag>
</taglib>
-------------------------------------------------------------------------
My class file (in web-inf/classes dir)


--------------------------------------------------------------------------
My jsp file (root)

<html><body>

<%@ taglib prefix="my" uri="dog" %>

<my:dimple>
${alpha}
</my:dimple>

</body></html>

I cant get this thing working . Please help.


[BPSouther: Added code tags]
[ August 31, 2007: Message edited by: Ben Souther ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, you should be following convetional naming standards. Classes should being with a capital letter. As in Test2.

Secondly, place your class in a package other than the default. See the JSP FAQ for more information on this.
 
saravana.T kumar
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, it worked.

And why should it be kept inside packages and not in the classes folder

2.is this above thing appplicable to custom tags or all jsp files which includes classes
 
Michael Ku
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
saravana, did you read the JSP FAQ concerning this subject?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic