Solved

facing a problem while creating custom tag

Posted on 2009-07-09
4
300 Views
Last Modified: 2013-11-24
Hi In the below example i want to use one custom tag, but i am facing one problem while i testing this application.
the error is like

"
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 5 in the jsp file: /index.jsp
Generated servlet error:
SimpleTagTest2 cannot be resolved to a type

An error occurred at line: 5 in the jsp file: /index.jsp
Generated servlet error:
SimpleTagTest2 cannot be resolved to a type


      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
"

and My JSP,tag handler class,tld mentioned in the code
u please verify the code and tell me where is the problem
MYJSP
 
<%@ taglib prefix="myTags" uri="simpleTags" %>
<html>
<body>
Simple Tag 2:
<myTags:simple2>
 This is The Body
 </myTags:simple2>
</body>
</html>
----------------------------------------------------------------
MY TLD
----
<?xml version="1.0" encoding="ISO-8859-1" ?>
<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/web-jsptaglibrary_2_0.xsd" version="2.0">
 
<tlib-version>1.2</tlib-version>
<uri>simpleTags</uri>
<tag>
 <description>Hi I am Manually Generated Tag</description>
 <name>simple2</name>
 <tag-class>SimpleTagTest2</tag-class>
 <body-content>scriptless</body-content>
</tag>
</taglib>
-----------------------------------------------------------------
My TAGHANDLER CLASS
---
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.*;
public class SimpleTagTest2 extends SimpleTagSupport
{
	public void doTag()throws JspException,IOException
	{
		getJspBody().invoke(null);
	}
}

Open in new window

0
Comment
Question by:haneefnb
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
mahome earned 500 total points
ID: 24820825
Did you check if SimpleTagTest2 gets compiled in WEB-INF/classes?
You can try using a package, don't forget to update you tld for that. Sometimes that helps.
0
 

Author Comment

by:haneefnb
ID: 24821146
ok. u please tell me what is the purpose of the doTag(),doStartTag(),doEndTag() in the Tag handler class
0
 
LVL 10

Expert Comment

by:mahome
ID: 24821270
Is the error gone? If yes, what did help?

For Tag Handler, look here: http://onjava.com/pub/a/onjava/2000/12/15/jsp_custom_tags.html
0
 

Author Closing Comment

by:haneefnb
ID: 31601957
Thanks...
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven java path setting 5 63
groupSum6 challenge 6 101
hibernate example for saving data 19 52
jboss wildfly 10.1 10 228
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question