• 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

jsp tag handler

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i m getting an error as given below. plz help me out
<Aug 23, 2001 2:28:21 PM GMT+05:30> <Error> <HTTP> <[WebAppServletContext(3534544,nextcard)] Servlet failed with Exception
weblogic.servlet.jsp.JspException: (line 1): Could not parse deployment descriptor: java.io.IOException: cannot resolve '/hello' into a valid tag library
at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:644)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY(JspLexer.java:3968)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE(JspLexer.java:3696)
at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java:3543)
at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING(JspLexer.java:1851)
at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:1692)
at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1574)
at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:898)
at weblogic.servlet.jsp.JspParser.doit(JspParser.java:71)
at weblogic.servlet.jsp.JspParser.parse(JspParser.java:139)
at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:113)
at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:253)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:313)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:180)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:148)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:306)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:246)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1631)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
 
sowmya vasisht
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
solution is to give the complete path of tld file
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This uri="/hello" must be the same as in web.xml
eg:
<taglib>
<taglib-uri>/hello</taglib-uri>
<taglib-location>/WEB-INF/tlds/hello.tld</taglib-location>
</taglib>
Check every file and you can clear your problem.
---------------------
ruijin yang
SCJP2
[This message has been edited by ruijin yang (edited August 24, 2001).]
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using weblogic 6.0. i want to use taglib with my jsp ... so i created a simple tag & am trying to use it ... but it dosnt work. Plz let me know where am i doing anything wrong......
am CONFUSED..
Here is my web.xml

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<taglib>
<taglib-uri>hello</taglib-uri>
<taglib-location>>/WEB-INF/tlds/hello.tld</taglib-location>
</taglib>
</web-app>
here is my hello.tld
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>

<tag>
<name>hello</name>
<tagclass>com.hello.Hello</tagclass>

<bodycontent>empty</bodycontent>

<attribute>
<name>name</name>
<required>false</required>
<rtexpvalue>false</rtexpvalue>
</attribute>
</tag>
</taglib>

I created following folder under WEB-INF
/WEB-INF/tlds/
in this folder i have hello.tld
/WEB-INF/com/hello/
i have my Hello.class under this dir.
Hello.java is as under

package com.hello;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
/**
* This is a simple tag example to show how content is added to the
* output stream when a tag is encountered in a JSP page.
*/
public class Hello extends TagSupport {
private String name=null;
/**
* Getter/Setter for the attribute name as defined in the tld file
* for this tag
*/
public void setName(String value){
name = value;
}
public String getName(){
return(name);
}
/**
* doStartTag is called by the JSP container when the tag is encountered
*/
public int doStartTag() {
try {
JspWriter out = pageContext.getOut();
out.println("<table border='1'>");
if (name != null)
out.println("<tr><td> Hello " + name + " </td></tr>");
else
out.println("<tr><td> Hello World </td></tr>");
} catch (Exception ex) {
throw new Error("All is not well in the world.");
}
// Must return SKIP_BODY because we are not supporting a body for this
// tag.
return SKIP_BODY;
}
}
here is the Hello.jsp which uses hello taglib...
<%@ taglib uri="hello" prefix="sample" %>
<sample:hello name="Sue"/>
but then also i get the error :
weblogic.servlet.jsp.JspException : could not parse deployment descripter: java.io.IOException: cannot resolve 'hello' into a valid tag library...
can u plz help me out....
thnks in advance

This uri="/hello" must be the same as in web.xml
eg:
<taglib>
<taglib-uri>/hello</taglib-uri>
<taglib-location>/WEB-INF/tlds/hello.tld</taglib-location>
</taglib>
Check every file and you can clear your problem.
 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please try
<taglib-location>/path/to/tag/lib/Hello.tld</taglib-location>
and let me know it it works.
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by sowmya vasisht:
solution is to give the complete path of tld file


*******************************************
CAN U tell me,
WHERE WE HAVE TO MENTION THAT tld FILE PATH....???

Khad M
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic