aspose file tools*
The moose likes JSP and the fly likes Custom tags Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Custom tags Problem" Watch "Custom tags Problem" New topic
Author

Custom tags Problem

saravana.T kumar
Greenhorn

Joined: Jul 13, 2007
Posts: 23
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

Joined: Jan 10, 2002
Posts: 61761
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
saravana.T kumar
Greenhorn

Joined: Jul 13, 2007
Posts: 23
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

Joined: Apr 20, 2002
Posts: 510
saravana, did you read the JSP FAQ concerning this subject?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom tags Problem