hello.
i am writing simple tag for accessing database.
i am getting follwing error
=======================================================================
weblogic.servlet.jsp.JspException: (line 26): Could not parse deployment descrip
tor: java.io.IOException: cannot resolve '/WEB-INF/DemoTags.tld' into a valid ta
g library
at weblogic.servlet.jsp.JspLexer.jspException(JspLexer.java:863)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY(JspLexer.java:47
14)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE(JspLexer.java:4538)
at weblogic.servlet.jsp.JspLexer.mDIRECTIVE(JspLexer.java:4385)
at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING(JspLexer.java:2223)
at weblogic.servlet.jsp.JspLexer.mTOKEN(JspLexer.java:2006)
at weblogic.servlet.jsp.JspLexer.nextToken(JspLexer.java:1888)
at weblogic.servlet.jsp.JspLexer.parse(JspLexer.java:1107)
at weblogic.servlet.jsp.JspParser.doit(JspParser.java:89)
at weblogic.servlet.jsp.JspParser.parse(JspParser.java:193)
at weblogic.servlet.jsp.Jsp2Java.outputs(Jsp2Java.java:119)
at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:255
)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:341)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:201)
at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:154)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.
java:370)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:240)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:321)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:198)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2637)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2359)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
========================================================================
i am using weblogic 6.1
i have put my tld file in /WEB-INF/DemoTags.tld
i don;t know why i getting this error.
my tld file is as follow.
<?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">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.2</jspversion>
<shortname>DemoTags</shortname>
<uri>
http://www.stardeveloper.com</uri>
<info>Demo Tags Library</info>
<tag>
<name>displaydata</name>
<tagclass>Tags.DataAccessTag</tagclass>
<teiclass>Tags.DataAccessTagTEI</teiclass>
<bodycontent>JSP</bodycontent>
<info>Data Access Tag.</info>
</tag>
</taglib>
and my class file is in /WEB-INF/classes/Tags/DataAccessTags.java
and /WEB-INF/classes/Tags/DataAccessTagsTEI.java
package Tags;
import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.Tag;
public class DataAccessTag implements BodyTag
{
private PageContext pc=null;
private BodyContent body=null;
private StringBuffer sb=new StringBuffer();
private Connection conn=null;
private Statement stmt=null;
private ResultSet rs=null;
public void setPageContext(PageContext p)
{
pc=p;
}
public void setParent(Tag t)
{
}
public Tag getParent()
{
return null;
}
public int doStartTag() throws JspException
{
String path="jdbc
dbc:Names";
String sql="select ID,first_name,last_name from Names";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(path);
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
setVariables();
}catch(SQLException e)
{
throw new JspTagException("An SQLException occured");
}catch(ClassNotFoundException e)
{
throw new JspTagException("Jdbc driver not found");
}
return EVAL_BODY_TAG;
}
public void setBodyContent(BodyContent b)
{
body=b;
}
public void doInitBody() throws JspException{}
private boolean setVariables() throws JspTagException
{
try
{
if(rs.next())
{
pc.setAttribute("id",rs.getObject(1).toString());
pc.setAttribute("first_name",rs.getObject(2).toString());
pc.setAttribute("last_name",rs.getObject(3).toString());
return true;
}else
{
return false;
}
}catch(SQLException e){
throw new JspTagException("SQLException occured");
}
}
public int doAfterBody() throws JspException
{
try{
sb.append(body.getString());
body.clear();
}catch(IOException e){
throw new JspTagException("Fatal IOException");
}
if(setVariables())
{
return EVAL_BODY_TAG;
}
try{
body.getEnclosingWriter().write(sb.toString());
}catch(IOException e){
throw new JspTagException("fatal IOException");
}
return SKIP_BODY;
}
public int doEndTag() throws JspException
{
try{
if(rs!=null)
{
rs.close();
rs=null;
}
if(stmt!=null)
{
stmt.close();
stmt=null;
}
if(conn!=null)
{
conn.close();
conn=null;
}
}catch(SQLException e){
}
return EVAL_PAGE;
}
public void release()
{
pc=null;
body=null;
sb=null;
}
}
and DataAccessTagTEI.java
package Tags;
import javax.servlet.jsp.tagext.*;
public class DataAccessTagTEI extends TagExtraInfo
{
public VariableInfo[] getVariableInfo(TagData data)
{
return new VariableInfo[]{
new VariableInfo("id","java.lang.String",true,VariableInfo.NESTED),
new VariableInfo("first_name","java.lang.String",true,VariableInfo.NESTED),
new VariableInfo("last_name","java.lang.String",true,VariableInfo.NESTED)
};
}
}
please help me...