Error using custom tag library
Hi All,
I am getting the following error:
On the browzer page when I invoke the foo.jsp page containing a tag
library.
Parsing of JSP File '/jsp/foo.jsp' failed:
/jsp/foo.jsp(7): Could not parse deployment descriptor:
org.xml.sax.SAXParseException: Could not parse taglib, starting at
line 5
probably occurred due to an error in /jsp/foo.jsp line 7:
<%@ taglib uri="example-taglib.tld" prefix="eg" %>
Wed Mar 27 13:17:49 PST 2002
The configutation is as follows
Foo.jsp in documentRoot/jsp
tld file in documentRoot/WEB-INF
class files in documentRoot/WEB-INF/classes/examples.
The server is spitting out the following code:
weblogic.servlet.jsp.JspException: (line 7): Could not parse
deployment descript
or: org.xml.sax.SAXParseException: Could not parse taglib, starting at
line 5
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at java.lang.RuntimeException.<init>(RuntimeException.java:47)
at weblogic.servlet.jsp.JspException.<init>(JspException.java:9)
Can anyone help me with this ?
Thanks for your help!!
SundayFunday!
Could anyone please let me know what is going on here?
SundayFunday!
[email protected] (SundayFunday) wrote in message news:<[email protected]>...
> Can anyone help me with this?!!
>
> Thanks!
>
> Sundayfunday.
>
> [email protected] (SundayFunday) wrote in message news:<[email protected]>...
> > Hi All,
> >
> > I am getting the following error:
> >
> > On the browzer page when I invoke the foo.jsp page containing a tag
> > library.
> >
> > Parsing of JSP File '/jsp/foo.jsp' failed:
> > --------------------------------------------------------------------------------
> > /jsp/foo.jsp(7): Could not parse deployment descriptor:
> > org.xml.sax.SAXParseException: Could not parse taglib, starting at
> > line 5
> > probably occurred due to an error in /jsp/foo.jsp line 7:
> > <%@ taglib uri="example-taglib.tld" prefix="eg" %>
> > --------------------------------------------------------------------------------
> > Wed Mar 27 13:17:49 PST 2002
> >
> >
> >
> > The configutation is as follows
> >
> > Foo.jsp in documentRoot/jsp
> >
> > tld file in documentRoot/WEB-INF
> > class files in documentRoot/WEB-INF/classes/examples.
> >
> >
> >
> > The server is spitting out the following code:
> >
> > weblogic.servlet.jsp.JspException: (line 7): Could not parse
> > deployment descript
> > or: org.xml.sax.SAXParseException: Could not parse taglib, starting at
> > line 5
> > at java.lang.Throwable.fillInStackTrace(Native Method)
> > at java.lang.Throwable.fillInStackTrace(Compiled Code)
> > at java.lang.Throwable.<init>(Compiled Code)
> > at java.lang.Exception.<init>(Compiled Code)
> > at java.lang.RuntimeException.<init>(RuntimeException.java:47)
> > at weblogic.servlet.jsp.JspException.<init>(JspException.java:9)
> >
> >
> > Can anyone help me with this ?
> >
> > Thanks for your help!!
> >
> > SundayFunday!
Similar Messages
-
Simultaneous Client and Server Form Validation using Custom Tag Library
I am developing a custom tag library for validator tags
which are capable of doing client side validation (Javascript)
and server side (Java). My problem is with the development
of a regular expression based validator. Because of differences
in the way Javascript and Java handle regular expressions
i can not use the same regular expression for both types of
validation. Is there any way to convert a valid regular
expression from the java.util.regex format into the Javascript
format or vice versa? My major problems are with the (or, ||)
statements and the user of backslashes.If you are speaking of RE syntax flavours, they are basically the same(namely perl5 flavour). Any expression that works in JS should work in j.u.regex too.
Though, their usage is quite different.
So, there is no need for convertion of expressions.
But porting the code may be not so trivial. -
Problem using custom tag library in portlet's jsp
Hi,
I created a custom portlet (a JSR 168 portlet) and I'm using a tag library that I previously developed. Normally it works fine, but sometimes I get a ClassCastException. Once I redeploy the portlet everything works again. This is Oracle Portal 10.1.4.
Has anybody encountered similar problems?
Here's the exception:
taglib exception:
java.lang.ClassCastException at timecardreminderportlet.html._view._jspService(_view.java:201) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824) at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121) at oracle.webdb.wsrp.server.RequestDispatcherImpl.include(Unknown Source) at org.mitre.isis.trs.reminder.portlet.TimecardReminderPortlet.doDispatch(TimecardReminderPortlet.java:108) at javax.portlet.GenericPortlet.render(Unknown Source) at oracle.webdb.wsrp.server.Server.getMarkup(Unknown Source) at oracle.webdb.wsrp.WSRP_v1_Markup_PortType_Tie.invoke_getMarkup(WSRP_v1_Markup_PortType_Tie.java:224) at oracle.webdb.wsrp.WSRP_v1_Markup_PortType_Tie.processingHook(WSRP_v1_Markup_PortType_Tie.java:499) at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:230) at com.sun.xml.rpc.server.http.ea.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:153) at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830) at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224) at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)Hi,
I created a custom portlet (a JSR 168 portlet) and I'm using a tag library that I previously developed. Normally it works fine, but sometimes I get a ClassCastException. Once I redeploy the portlet everything works again. This is Oracle Portal 10.1.4.
Has anybody encountered similar problems?
Here's the exception:
taglib exception:
java.lang.ClassCastException at timecardreminderportlet.html._view._jspService(_view.java:201) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824) at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121) at oracle.webdb.wsrp.server.RequestDispatcherImpl.include(Unknown Source) at org.mitre.isis.trs.reminder.portlet.TimecardReminderPortlet.doDispatch(TimecardReminderPortlet.java:108) at javax.portlet.GenericPortlet.render(Unknown Source) at oracle.webdb.wsrp.server.Server.getMarkup(Unknown Source) at oracle.webdb.wsrp.WSRP_v1_Markup_PortType_Tie.invoke_getMarkup(WSRP_v1_Markup_PortType_Tie.java:224) at oracle.webdb.wsrp.WSRP_v1_Markup_PortType_Tie.processingHook(WSRP_v1_Markup_PortType_Tie.java:499) at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:230) at com.sun.xml.rpc.server.http.ea.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:153) at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830) at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224) at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534) -
I am trying to use a custom tag but receive an error when I use it on a jsp page.
I have a tag handler class file, tag library descriptor file, specified the path to the .tld in the web.xml file.
The error implies that it cannot find the SimpleTag.class file, though I put it in the \webapps\examples\WEB-INF\classes\ directory.
Here is the error. Does anyone know what else it could be?
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
C:\jakarta-tomcat-4.0.1\work\localhost\examples\jsp\jspVisual\ch10\using_0005ftag$jsp.java:63: Class org.apache.SimpleTag not found.
SimpleTag_jspx_th_myFirstTag_SimpleTag_0 = new SimpleTag();I could not see any obvious mistakes. But what you could try, in order to isolate the problem, is to bypass the web.xml. In other words access the TLD directly by doing this in your JSP
<%@ taglib uri="/WEB-INF/jsp/tag_library_descriptor.tld" prefix="myFirstTag" %>
if that does work then move the your TLD out of the jsp folder and into WEB-INF , then try
<%@ taglib uri="/WEB-INF/tag_library_descriptor.tld" prefix="myFirstTag" %>
Maybe someone else has better idea. -
Illegal Access Error : using Custom Tags
Ive a very simple custom tag that try to print curent date on webpage but when I try to run it gives me following error
java.lang.IllegalAccessError: try to access class com.sun.xml.tree.ParentNode from class org.apache.jasper.compiler.TagLibraryInfoImpl
java.lang.IllegalAccessError: try to access class com.sun.xml.tree.ParentNode fr
om class org.apache.jasper.compiler.TagLibraryInfoImpl
Here is my jsp code
<html>
<head>
<%@ taglib uri="http://127.0.0.1:8080/examples/cdate.tld" prefix="examples"%>
</head>
<body>
The file is <examples:cdate/>
</body>
</html>
here goes cdate.tld code
<?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.1</jspversion>
<shortname>examples</shortname>
<uri>http://www.mycompany.com/taglib</uri>
<info>An example tag library</info>
<tag>
<name>cdate</name>
<tagclass>datex.DateTag</tagclass>
<info>Returns Current Date</info>
</tag>
</taglib>
here is web.xml entry
<taglib>
<taglib-uri>
http://127.0.0.1:8080/examples/WEB-INF/cdate.tld
</taglib-uri>
<taglib-location>
/WEB-INF/cdate.tld
</taglib-location>
</taglib>
here is the taghandler class code
package datex;
import java.io.*;
import java.util.Date;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class DateTag extends javax.servlet.jsp.tagext.TagSupport {
private String date;
public int doStartTag() throws JspException {
StringBuffer html = new StringBuffer();
date = new Date().toString();
html.append("Current Date : ");
html.append(date);
try {
pageContext.getOut().write(html.toString());
} catch (IOException ioe) {
throw new JspException(ioe.getMessage());
return EVAL_BODY_INCLUDE;
public void setDate(String s) {
this.date = s;
can any one plz hlp mewhen i put the struts tags into the subforld such as /web-inf/tags , the jsp page tell me parsing tags error.
should i must put all this tags in the right fold?
i configure the url location in the web.xml as the route /web-inf/tags/....tld why invalid? -
Problem in using jsp 1.1 custom tag library in websphere
I am using was 3.5.2. Everything has been installed properly. I am using jdeveloper 3.2 for building the jsp application using custom tag library. But when I run the jsp file in browser, its gives dr. watson on java.exe. I am using websphere 3.5.2 application server.
Have any body got this type of prob. ...
pls respond asap.
Thanks in Advance
YogeshLet me explain the problem again
I am using was(websphere) 3.5.2. Everything has been installed properly. I am using jdeveloper 3.2 for building the jsp application using custom tag library.
Application works fine in JDeveloper 3.2.
Application works fine even when deployed on JRun 3.0. ( we are evaluating various web servers).
How when deployed on WAS and I run the jsp file in browser, its gives dr. watson on java.exe. I am using websphere 3.5.2 application server.
WAS has typical settings as against JRun and Tomcat and may be I have not set the necessary paths.
Have any body got this type of prob. ...
pls respond asap.
Thanks in Advance
Yogesh
null -
Custom Tag Library - error in IWS
My environment: Solaris 2.7, IWS4.1 SP3.
I currently try to run the Custom Tag Library example from IWS itself in
server_root/plugins/samples/servlets/taglibs. I follow the instructions to
config the IWS but fail to run the example. I turn on JSP debugging and
find the following error messages:
[12/Oct/2000:13:03:10] info (28609): Service(): uri=/jsps/test-tags.jsp
cgiScriptName=/jsps/test-tags.jsp token=null cached=false
[12/Oct/2000:13:03:10] info (28609): Internal Info: loading servlet
/jsps/test-tags.jsp
[12/Oct/2000:13:03:10] info (28609): JSP: This is a jsp 1.x file
[12/Oct/2000:13:03:10] info (28609): JSP: Before JSP1x compiler.compile,
servletName = /jsps/test-tags.jsp servletPath =
/u01/devin/docs/jsps/test-tags.jsp & dir = ../ClassCache
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace: Package name is:
jsps.jsps
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace: Class name is:
test0002dtags_jsp
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace: Java file name is:
/opt/netscape/server4/https-devin/config/../ClassCache/_jsps/_jsps/_test_000
2dtags_jsp.java
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace: Class file name is:
/opt/netscape/server4/https-devin/config/../ClassCache/_jsps/_jsps/_test_000
2dtags_jsp.class
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace:
Handling Directive: page {language=java}
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace: Accepted
org.apache.jasper.compiler.Parser$Directive at /jsps/test-tags.jsp(0,0)
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace:
Handling Directive: taglib {uri=/jsps/test-tags.jar, prefix=tt}
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace: Copying
/jsps/test-tags.jar into
/opt/netscape/server4/https-devin/config/../ClassCache//jsps/test-tags.jar
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace: Adding jar
/opt/netscape/server4/https-devin/config/../ClassCache//jsps/test-tags.jar
to my classpath
[12/Oct/2000:13:03:10] info (28609): Aborting JVM
[12/Oct/2000:13:03:10] info (28609): Exiting JVM due to: jvm_abort () and
jvm.exitOnAbort > 0
[12/Oct/2000:13:03:10] info (28609): JVM exit statistics:
AttachedThreads/Max=1/1, ActiveThreads/Max=1/1
[12/Oct/2000:13:03:11] info (28716): Initializing MMapSession Manager to
hold a maximum of (1000) sessions, each of which can store a maximum of
(100) values and no value size bigger than (1024) bytes, with a timeout
value of (1800) seconds
IWS keeps aborting JVM and one can see from the log that it abort jvm when
trying to :
[12/Oct/2000:13:03:10] info (28609): JSP1x Jasper Trace: Adding jar
/opt/netscape/server4/https-devin/config/../ClassCache//jsps/test-tags.jar
to my classpath
[12/Oct/2000:13:03:10] info (28609): Aborting JVM
I have tried another much simple Custome Tag Library example that only contain a simple tag that do output to page, but still getting the same error.I had the same issue with WAS 6.1.0.2. I do not have a solution, but a workaround. I hope the workaround I have works for you too.
In my case, I have the TLD files deployed in a jar. So, the JSP 2.0 container is supposed to read those TLD files from the jar file. Since that was not happening, I extracted the TLD file from the jar file and placed it under my web project's WEB-INF folder.
I restarted my server and after that it worked.
Look at the IBM site to see if they have come up with a patch for WAS 6.0.
Hope this helps.
-Javier -
Hi, can anyone advise as to whether my tag library code (based
on Apache Jakarta Project) will actually achieve connection
pooling functionality across my entire JSP based application? I
am slightly concerned that my OracleConnectionCacheImpl object
may exist multiple times, hence rendering my conection pooling
attempt useless.
package com.solved.tag.dbtags.connection;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspTagException;
import javax.sql.DataSource;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import oracle.jdbc.pool.OracleConnectionCacheImpl;
* <p>JSP tag connection, used to get a
* java.sql.Connection object.</p>
* <p>JSP Tag Lib Descriptor
* <pre>
* <name>connection</name>
<tagclass>com.solved.tag.dbtags.connection.ConnectionTag</t
agclass>
* <bodycontent>JSP</bodycontent>
<teiclass>com.solved.tag.dbtags.connection.ConnectionTEI</t
eiclass>
* <info>Opens a connection based on a jndiName.</info>
* <attribute>
* <name>id</name>
* <required>true</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* </pre>
* @author Matt Shannon
public class ConnectionTag extends TagSupport {
static private OracleConnectionCacheImpl cache = null;
public int doStartTag() throws JspTagException {
try {
Connection conn = null;
if (cache == null) {
try {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup
("jdbc/pool/OracleCache");
cache = (OracleConnectionCacheImpl)ds;
catch (NamingException ne) {
throw new JspTagException(ne.toString());
conn = cache.getConnection();
pageContext.setAttribute(getId(),conn);
catch (SQLException e) {
throw new JspTagException(e.toString());
return EVAL_BODY_INCLUDE;
package com.solved.tag.dbtags.connection;
import java.sql.Connection;
import java.sql.SQLException;
import javax.servlet.jsp.tagext.TagSupport;
* <p>JSP tag closeconnection, used to close the
* specified java.sql.Connection.<p>
* <p>JSP Tag Lib Descriptor
* <pre>
* <name>closeConnection</name>
<tagclass>com.solved.tag.dbtags.connection.CloseConnectionTag&
lt;/tagclass>
* <bodycontent>empty</bodycontent>
* <info>Close the specified connection. The "conn"
attribute is the name of a
* connection object in the page context.</info>
* <attribute>
* <name>conn</name>
* <required>true</required>
* <rtexprvalue>false</rtexprvalue>
* </attribute>
* </pre>
* @author Matt Shannon
* @see ConnectionTag
public class CloseConnectionTag extends TagSupport {
private String _connId = null;
* The "conn" attribute is the name of a
* page context object containing a
* java.sql.Connection.
* @param connectionId
* attribute name of the java.sql.Connection to
close.
* @see ConnectionTag
public void setConn(String connectionId) {
_connId = connectionId;
public int doStartTag() {
try {
Connection conn = (Connection)pageContext.getAttribute
(_connId);
conn.close();
} catch (SQLException e) {
// failing to close a connection is not fatal
e.printStackTrace();
return EVAL_BODY_INCLUDE;
public void release() {
_connId = null;
package com.solved.tag.dbtags.connection;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
* TagExtraInfo for the connection tag. This
* TagExtraInfo specifies that the ConnectionTag
* assigns a java.sql.Connection object to the
* "id" attribute at the end tag.
* @author Matt Shannon
* @see ConnectionTag
public class ConnectionTEI extends TagExtraInfo {
public final VariableInfo[] getVariableInfo(TagData data)
return new VariableInfo[]
new VariableInfo(
data.getAttributeString("id"),
"java.sql.Connection",
true,
VariableInfo.AT_END
data-sources.xml:
<?xml version="1.0"?>
<!DOCTYPE data-sources PUBLIC "Orion data-
sources" "http://xmlns.oracle.com/ias/dtds/data-sources.dtd">
<data-sources>
<data-source
class="oracle.jdbc.pool.OracleConnectionCacheImpl"
name="jdbc/pool/OracleCache"
location="jdbc/pool/OracleCache"
url="jdbc:oracle:thin:@oracle1:1521:pdev"
>
<property name="maxLimit" value="15" />
<property name="cacheScheme" value="2" />
<property name="user" value="console" />
<property name="password" value="console" />
<description>
This DataSource is using an Oracle-native DataSource Class so as
to allow Oracle Specific extensions.
A getConnection() call on this DataSource will return
oracle.jdbc.driver.OracleConnection.
The connection returned is a logical connection.
The caching scheme in place is Fixed Wait. Refer below to
possible values.
Dynamic 1
Fixed Wait 2
Fixed Return Null 3
</description>
</data-source>
</data-sources>
many thanks,
Matt.Hi. Show me your pool definition.
Joe
Ramamurthy wrote:
I am using the jsp custom tag library from BEA called sqltags.tld which came with Weblogic 5.1. Currently I am using Weblogic6.1 sp2 on Solaris.
I have created a Connection Pool for Sybase database using the driver com.sybase.jdbc.SybDriver.
When I created jsp page to connect to the connection pool using sqltags custom tag library, I am getting the error
"javax.servlet.jsp.JspException: Failed to write body content
at weblogic.taglib.sql.ConnectionTag.doAfterBody(ConnectionTag.java:43)
at jsp_servlet.__hubwcdata._jspService(__sampletest.java:1014)"
After this message, whenever I try to access the same jsp page I am getting the message
"javax.servlet.jsp.JspException: Failed to load JDBC driver: weblogic.jdbc.pool.D
river
at weblogic.taglib.sql.ConnectionTag.doStartTag(ConnectionTag.java:34)
at jsp_servlet.__hubwcdata._jspService(__sampletest.java:205)".
Can you please help me the reason why this problem is happening and how to fix this ?
This problem doexn't happen consistently. This occurs once in a while.
I tried to increase Login delay Seconds parameter in the Connection Pool to 15 sec. It didn't help me much.
Thanks for your help !!!
Ram -
How to use a tag library in multiple web applications?
Morning all,
Environment: Tomcat 5 on Apache2 using Mod_JK connector on Windows XP
I have developed a custom tag library and tested it out and its working great.
Now, How do I use in my other web applications? Do I need to copy the JAR file to webapps\app1\WEB-INF\lib, webapps\app2\WEB-INF\lib etc directories?
The problem with this approach is, if I happen to change the tag library code, I will have to make sure that I remember to copy the new JAR file to the above mentioned directories. Ofcourse I can write a simple ant script that would do it for me, but I was wondering if there was an efficient and yet simple way of achieving the same.
Thanks in advance,
JoeThanks Vidyut! You've answered my question.
I placed the jar file in the $CATALINA_HOME/shared/lib directory. But where should I place the taglib TLD file? And how should I reference it in web.xml?
Currently, my web.xml is as follows and it doesn't work.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<taglib>
<taglib-uri>http://abc.com</taglib-uri>
<taglib-location>c:\Tomcat\shared\lib\mytags-taglib.tld</taglib-location>
</taglib>
</web-app>
Thanks again!
Joe -
Custom tag library called multiple times
Hi ppl ,
I have a custom tag library which i use to populate some menu components. When i do call my custom tag library though , it is called multiple times, use case is as follows.
I have menu tabs and menu bars which thanks to Mr.Brenden is working splendidly as so:-
<af:menuTabs>
<af:forEach var="menuTab" items="#{bindings.menu.vwUserMenuTabRenderer.rangeSet}">
<af:commandMenuItem text="#{menuTab.MenuLabel}"
shortDesc="#{menuTab.MenuHint}"
rendered="true"
immediate="true"
selected="#{sessionScope.selectedMenuId == menuTab.MenuId }"
onclick="fnSetSelectedValue('#{menuTab.MenuId}')" >
</af:commandMenuItem>
</af:forEach>
</af:menuTabs>
<af:menuBar>
<af:forEach var="menuBar" items="#{bindings.menu.vwUserMenuBarRenderer.rangeSet}">
<af:commandMenuItem onclick="return clickreturnvalue()"
onmouseover="dropdownmenu(this, event,#{menuBar.MenuId}, '150px')"
onmouseout="delayhidemenu()"
text="#{menuBar.MenuLabel}"
action="#{menuBar.MenuUri}"
rendered="#{menuBar.ParentId == sessionScope.selectedMenuId}"
immediate="true" />
</af:forEach>
</af:menuBar>
</afc:cache>
now all of this code is within a subview , and just directly below the subview tag , i have the call to my custom tag library:-
<myCustomTagLib:menuCascade />
only issue now is that assuming i have in all 7 menu bar components, the doStartTag is called 7 times. the relevant code within my custom tag class is as follows :-
public int doStartTag() throws JspException {
return (EVAL_BODY_INCLUDE);
public int doEndTag() throws JspException {
try {
declareVariables();
return EVAL_PAGE;
}catch (Exception ioe) {
throw new JspException(ioe.getMessage());
and within my declareVariables method i do an out of the jscript ( out.print(jscript.toString()); ) which is a simple string generated based on certain conditions...
now it seems to be working fine on the front end , but when i view the source of the page, i notice that the declaration is called multiple times, and this happens because the doStartTag method is called multiple times, i haven't even nested the call to the custom tag within the menu components , any clue as to whats going wrong ?
Cheers
KHi,
if you add the following print statement
System.out.println("rendering "+FacesContext.getCurrentInstance().getViewRoot().getViewId());
Then the output in my case is
07/04/24 08:14:04 rendering /BrowsePage.jsp
07/04/24 08:14:05 rendering /otn_logo_small.gif
The image comes from the file system, which means it is rendered by the JSF lifecycle. If you reference the image with a URL then the lifecycle doesn't render the image but only refrences it.
To avoid your prepare render code to be executed multiple times, just check for jsp and jspx file extensions, which will guarantee that your code only executes for JSF pages, not for loaded files.
The reason why this happens is because the JSF filter is set to /faces , which means all files that are loaded through that path
Frank -
Can i make own formatted textbox using custom tag
Hai,
Can i create own format textbox similar to vb activex control.for example i want make own formatted textbox for enter only numeric value if entry any alpha value it's show error.Is this possible using custom tagHai,
Can i create own format textbox similar to vb
activex control.for example i want make own
formatted textbox for enter only numeric value if
entry any alpha value it's show error.Is this
possible using custom tag
If you mean a custom text box in a web page without an applet (in other words an html component), then Java has nothing to do with it. And by mentioning activex (even only in a 'like' comparison), and custom tag, you are once again hinting that you want an html component. I think you need to place your request to a JavaScript Forum, which, once again, has absolutely nothing to do with Java.
A "custom tag" in JSP is not an HTML Tag. It may look a little like an html or xml tag, but it is evaluated on the server side. The control you need must be executed on the client side, which, once again, tells me you need to post to a JavaScript forum. -
Problem deploying and using custom Tags in jar files
I am trying to create a custom tag library of Java classes, package them in a JAR file, and use them in another web application. Here is the JAR file structure, named mytags.jar:
META-INF
META-INF/manifest.mf
META-INF/taglib.tld
mytags/FooBar.class
mytags/Another.class
...Here is the taglib.tld file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib xmlns="http://java.sun.com/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.0</tlib-version>
<short-name>foo</short-name>
<uri>fooTags</uri>
<info>My tags</info>
<tag>
<name>fooBar</name>
<tag-class>mytags.FooBar</tag-class>
<body-content>empty</body-content>
<attribute>
<name>name</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>The FooBar class has getName(String) and setName() methods.
In the web application, I have copied mytags.jar into the WEB-INF/lib directory. I've verified that it lands in the corresponding directory for my appserver (I'm using Tomcat 6.0.10).
Here's the header for my JSP:
<%@ page language="java" contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="fooTags" prefix="foo" %>
<foo:fooBar name="dummy" />
...When I access my page, the browser sits there and spins, not able to do anything. I know that some of the content is executed, but it is not able to get to the fooTags. I have tried replacing fooTags with WEB-INF/lib/mytags.jar, to no effect.
According to the docs, I should not need to include anything in web.xml to reference the fooTags. The tag library classes are valid, since I used them as local tags prior to moving them into a Jar library.
Any help would be appreciatedTake the code of the jsp file :
<%@ page language="java" %>
<%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
<title> First Struts Application </title>
</head>
<body>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr bgcolor="#36566E">
<td height="68" width="48%">
<div align="left">
<img src="images/hht.gif" width="220" height="74">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<html:form action="Lookup"
name="lookupForm"
type="wiley.LookupForm" >
<table width="45%" border="0">
<tr>
<td>Symbol:</td>
<td><html:text property="symbol" /> </td>
</tr>
<tr>
<td colspan="2" align="center"><html:submit/> </td>
</tr>
</table>
</html:form>
</body>
</html> -
Trying to create custom tag library
I'm a novice trying to create a simple custom tag library application. As such I need a couple import statements like
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext;
This statements will not compile. I'm using Java 2 1.4_03 and WSDP 1.3. My CLASSPATH currently holds
c:\jwsdp\common\lib\servlet-api.jar
and
c:\j2sdk\lib\mysql-connector-java-3.0.11-stable-bin.jar.
I've got JAVA_HOME set to c:\j2sdk and JWSDP_HOME set to c:\jwsdp.
Thank you very much for any assistance you are able to render.Thanks for your reply. I'm using the TextPad editor, which uses CLASSPATH.
I've figured out the answer. I needed to add
c:\jwsdp\common\lib\jsp-api.jar
to my CLASSPATH.
Again, thanks. -
How to use custome tag lib in the JSP page?
How to use custome tag lib in the JSP page?...with JDeveloper
http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtTopicFile.working_with_jsp_pages%7Cjsp_ptagsregistering~html/
-
sir
plz tell me how to use custom tag in jsp.plz describe it.
i will be thankful to uDo you want to use taglibs or develop custom tags? Either way take a look at these:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags.html
http://www.stardeveloper.com/articles/display.html?article=2001081301&page=1
http://www.onjava.com/pub/a/onjava/2000/12/15/jsp_custom_tags.html
http://jakarta.apache.org/taglibs/tutorial.html
http://www.ibm.com/developerworks/edu/j-dw-java-custom-i.html
http://www.herongyang.com/jsp/tag.html
Maybe you are looking for
-
Are there any 3rd party LabVIEW and/or TestStand code analysis tools
I am looking for any 3rd party tools to analyze LabVIEW and/or TestStand code. Looking for tools that will check for memory leaks, timing, and any other code performance problems. I know LabVIEW has the profiler tool, but I am looking for 3rd party t
-
I am using Outlook 2010 and I have set this as default. Furthermore, this does not seem to be recognised by Windows XP as it is not listed in IE8 options, programs drop down list. Very strange. Had no problems previously with Outlook Express.
-
Defaulting Cost accounting distribution line at Responsibility level
Hi Project Accounting Experts, I have now rephrased the query: PRC: Distribute Usage and Miscellaneous Costs need to default one of the segment values based on the responsibility that created the misc transaction for the expenditiure batch Below is t
-
Bayer Filter and colour balance.
Hi all. I have recently been acquiring images using a mikrotron MC1363 camera and LV code 'Grab and save to AVI'. I have then used ImageJ to create a stack of U8 images. My problem then arises in that I need to apply a bayer filter and colour balance
-
ECS scenario - Service PO and Service Entry sheets in backend
Hello, We are on SRM_SERVER 550, SP07 and in the process of moving to ECS scenario. There are some questions from me on the Service procurement in ECS. 1. When we create a PO with service item in SRM, will it get copied to backend as a Po with item