• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Custom tags Problem

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
saravana, did you read the JSP FAQ concerning this subject?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic