Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error while compiling  RSS feed

 
gaurav chhabra
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello sir
i m using tomcat and new to JSTL , sir i have my JSP file as follows ...

t2_final.jsp

<!-- JAI SHRI RAM -->
<%@ taglib uri="first_taglib.tld" prefix="ram" %>

<HTML>
<HEAD>


<TITLE>JAI SHRI RAM</TITLE>

</HEAD>

<BODY>

<H1><ram:sita /></H1>


</BODY>
</HTML>


now i have my .TLD file as follows ........

first_taglib.tld

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<!-- a tag library descriptor -->
<taglib>


<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>ram</shortname>

<info>
A tag library from Core Servlets and JavaServer Pages,
http://www.coreservlets.com/.
</info>


<tag>

<name>sita</name>
<tagclass>t2</tagclass>
<bodycontent>EMPTY</bodycontent>
<info>Simplest example: inserts one line of output</info>


</tag>
<!-- Other tags defined later... -->


</taglib>

and my class file is as follows .......

t2.java

//JAI SHRI RAM

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;


public class t2 extends TagSupport {
public int doStartTag() {
try {
JspWriter out = pageContext.getOut();
out.print("Custom tag example " +
"(coreservlets.tags.ExampleTag)");
} catch(IOException ioe) {
System.out.println("Error in ExampleTag: " + ioe);
}
return(SKIP_BODY);
}
}


i have complied my file and get the class file successfuly and i have all the files in tomcat4.1\webapps\root\ .but when i am running it through browser then it is giving the error in the JSP file i.e ts_final, that it is unable to compile .... please tell me that why this error is coming/..

thanks for help
gauravt2.javafirst_taglib.tldt2_final.jsp
 
Jeremy Wilson
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On first access the jsp is compiled by the container to basically a servlet. If it cannot do this you get that error. Make sure the java home and classpath is set correctly so that tomcat has access to the jdk.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!