Taglib uri problem
Hi all
I created a web module project and add a JSP file u201CcustomTagWelcome.jspu201D and a TLD file u201Cadvjhtp1-taglib.tldu201D to the webContent directory. I added also a tag handler
u201CWelcomeTagHandleru201D.
The jsp code:
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Fig. 10.30: customTagWelcome.jsp -->
<!-- JSP that uses a custom tag to output content. -->
<%-- taglib directive --%>
<%@ taglib uri = "advjhtp1-taglib.tld" prefix = "advjhtp1" %>
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Simple Custom Tag Example</title>
</head>
<body>
<p>The following text demonstrates a custom tag:</p>
<h1>
<advjhtp1:welcome />
</h1>
</body>
</html>
The tld content:
<?xml version = "1.0"?>
<!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>advjhtp1</shortname>
<info>
A simple tab library for the examples
</info>
<!-- A simple tag that outputs content -->
<tag>
<name>welcome</name>
<tagclass>
com.deitel.advjhtp1.jsp.taglibrary.WelcomeTagHandler
</tagclass>
<bodycontent>empty</bodycontent>
<info>
Inserts content welcoming user to tag libraries
</info>
</tag>
<!-- A tag with an attribute -->
<tag>
<name>welcome2</name>
<tagclass>
com.deitel.advjhtp1.jsp.taglibrary.Welcome2TagHandler
</tagclass>
<bodycontent>empty</bodycontent>
<info>
Inserts content welcoming user to tag libraries. Uses
attribute "name" to insert the user's name.
</info>
<attribute>
<name>firstName</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<!-- A tag that iterates over an ArrayList of GuestBean -->
<!-- objects, so they can be output in a JSP -->
<tag>
<name>guestlist</name>
<tagclass>
com.deitel.advjhtp1.jsp.taglibrary.GuestBookTag
</tagclass>
<teiclass>
com.deitel.advjhtp1.jsp.taglibrary.GuestBookTagExtraInfo
</teiclass>
<bodycontent>JSP</bodycontent>
<info>
Iterates over a list of GuestBean objects
</info>
</tag>
</taglib>
In the u201Cothersu201D tab of web.xml I choose the tag-libs and for Taglib Location I choose the advjhtp1-taglib.tld. The Taglib Location is advjhtp1-taglib.tld. I added u201Cadvjhtp1-taglib.tldu201D as URI .
When I run the jsp in browser
http://devsrv:50000/servlet_jsp/customTagWelcome.jsp
I get the following exception:
#1.5 #0019DB661008005B0000008A000013B000044FA2C2FDE9C9#1213460381553#com.sap.engine.services.servlets_jsp.server.jsp.JSPParser#sap.com/servlet_jsp_test#com.sap.engine.services.servlets_jsp.server.jsp.JSPParser#Guest#0####b16b6e103a2d11ddb85a0019db661008#SAPEngine_Application_Thread[impl:3]_20##0#0#Error#1#/System/Server#Plain###application [servlet_jsp] Runtime error in compiling of the JSP file <C:/usr/sap/EP7/JC00/j2ee/cluster/server0/apps/sap.com/servlet_jsp_test/servlet_jsp/servlet_jsp/root/customTagWelcome.jsp> !
The error is: com.sap.engine.services.servlets_jsp.lib.jspparser.exceptions.JspParseException: Tag library descriptor cannot be found for uri:].
Exception id: [0019DB661008005B00000088000013B000044FA2C2FDE89A]#
#1.5 #0019DB661008005B0000008B000013B000044FA2C2FDEBF1#1213460381553#com.sap.engine.services.servlets_jsp.client.RequestInfoServer#sap.com/servlet_jsp_test#com.sap.engine.services.servlets_jsp.client.RequestInfoServer#Guest#0####b16b6e103a2d11ddb85a0019db661008#SAPEngine_Application_Thread[impl:3]_20##0#0#Error##Plain###application [servlet_jsp] Processing HTTP request to servlet [jsp] finished with error. The error is: com.sap.engine.services.servlets_jsp.server.exceptions.WebIOException: Internal error while parsing JSP page [C:/usr/sap/EP7/JC00/j2ee/cluster/server0/apps/sap.com/servlet_jsp_test/servlet_jsp/servlet_jsp/root/customTagWelcome.jsp].
at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.parse(JSPParser.java:118)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.getClassName(JSPServlet.java:238)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.compileAndGetClassName(JSPServlet.java:429)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: com.sap.engine.services.servlets_jsp.lib.jspparser.exceptions.JspParseException: Tag library descriptor cannot be found for uri:].
at com.sap.engine.services.servlets_jsp.lib.jspparser.syntax.JspTaglibDirective.verifyAttributes(JspTaglibDirective.java:146)
at com.sap.engine.services.servlets_jsp.lib.jspparser.syntax.JspDirective.parse0(JspDirective.java:141)
at com.sap.engine.services.servlets_jsp.lib.jspparser.syntax.JspDirective.parse(JspDirective.java:102)
at com.sap.engine.services.servlets_jsp.lib.jspparser.syntax.ElementCollection.parse(ElementCollection.java:89)
at com.sap.engine.services.servlets_jsp.lib.jspparser.syntax.ParserImpl.parse(ParserImpl.java:536)
at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.initParser(JSPParser.java:340)
at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.parse(JSPParser.java:106)
... 18 more
What is wrong with URI?
Thanks in advance
Yoel
Hi,
You need to add an entry for the <taglib-location> and <taglib-uri>
in the web.xml for using a tld in the project.
And then need to use the same url name in the jsp.
You can go through the following link for the details about web.xml:
http://edocs.bea.com/wls/docs61/webapp/web_xml.html#1017621
Thanks
Ritushree
Similar Messages
-
Error in using taglib uri in jsp
When i write the following code in my jsp to use the tags, i got the error -
JSP Parsing Error:The absolute uri: http://java.sun.com/jsf/html cannot be resolved in either web.xml or the jar files deployed with this application
And when i used the tld (html_basic.tld & jsf_core.tld), it gave me the error
JSP Parsing Error:Failed to load or instantiate TagLibraryValidator class: com.sun.faces.taglib.html_basic.HtmlBasicValidatoryou can use
<taglib>
<taglib-uri>/WEB-INF/html-basic.tld</taglib-uri>
<taglib-location>
/WEB-INF/html-basic.tld
</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/jsf-core.tld</taglib-uri>
<taglib-location>
/WEB-INF/jsf-core.tld
</taglib-location>
</taglib>
in your web.xml -
I'm using custom tags in my app (JSP 1.2). My tld is located in WEB-INF/tlds (not packaged in a JAR), meaning that the uri in the tld file should be picked up by JSP 1.2's autodiscovery. This works fine in actual deployment, but Nitrox claims that:
"The tag library uri "mytaglib" cannot be mapped to an existing tld file. "
when I attempt to reference it as follows from within my jsps:
<%@ taglib uri="mytaglib" prefix="m" %>
Do you know if this is a bug, or have any suggestions as to why the tld uri isn't being picked up by Nitrox?
Thanks,
JohnThis is a known (kind of) issue. There are 2 easy workarounds:
1- Specify the path to the tld file in the uri attribute. For example:
<%@ taglib uri="/WEB-INF/mytaglib.tld" prefix="m" %>
2- Map the tld file in web.xml. For example:
<taglib>
<taglib-uri>mytaglib</taglib-uri>
<taglib-location>/WEB-INF/mytaglib.tld</taglib-location>
</taglib>
M7 Support -
Taglib URI error in Weblogic60
Hi All,
having some trouble deploying my custom Tag, this is the error...
thanks in advance
Parsing of JSP File '/test/tagpage.jsp' failed:
/test/tagpage.jsp(1): Could not parse deployment descriptor:
java.io.IOException: cannot resolve 'taglib' into a valid tag library
probably occurred due to an error in /test/tagpage.jsp line 1:
<%@ taglib uri="taglib" prefix="input" %>
my directories look like this
myserver
test
- tagpage.jsp
WEB-INF
-web.xml
-taglib.tld
my code:
in jsp
-<%@ taglib uri="taglib" prefix="input" %>
in web.xml
-<?xml version="1.0" ?>
<!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>taglib</taglib-uri>
<taglib-location>/WEB-INF/taglib.tld</taglib-location>
</taglib>
</web-app>
I get the following error when I try to get my taglibs running in WLS 6.0 -
any ideas?
Parsing of JSP File '/Project.jsp' failed:
/Project.jsp(3): Could not parse deployment descriptor:
org.xml.sax.SAXParseException: Could not parse: taglib starting at line 1
probably occurred due to an error in /Project.jsp line 3:
<%@ taglib prefix="rdbm" uri="/rdbmstags6_0.tld" %>
Tue Feb 20 10:41:57 MST 2001
"Mark S." <[email protected]> wrote in message
news:[email protected]...
> Hi All,
>
> having some trouble deploying my custom Tag, this is the error...
>
> thanks in advance
>
> Parsing of JSP File '/test/tagpage.jsp' failed:
>
> /test/tagpage.jsp(1): Could not parse deployment descriptor:
> java.io.IOException: cannot resolve 'taglib' into a valid tag library
> probably occurred due to an error in /test/tagpage.jsp line 1:
> <%@ taglib uri="taglib" prefix="input" %>
>
> ------------------------------
>
> my directories look like this
>
> myserver
>
> test
>
> - tagpage.jsp
>
> WEB-INF
>
> -web.xml
>
> -taglib.tld
>
> -------------------------------
>
> my code:
>
> in jsp
>
> -<%@ taglib uri="taglib" prefix="input" %>
>
> in web.xml
>
> -<?xml version="1.0" ?>
>
> <!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>taglib</taglib-uri>
>
> <taglib-location>/WEB-INF/taglib.tld</taglib-location>
>
> </taglib>
>
> </web-app>
>
>
>
-
what is the use of
<%@ taglib uri="taglib" prefix="hbj" %>
in jsp?
The portal Content works fine even without that.
Any specific reasons?Hello Hanif,
This is the we declare taglibs in JSP files. Check this for definition:
http://java.sun.com/products/jsp/tutorial/TagLibraries5.html#61992
After declaring this taglib <%@ taglib uri="taglib" prefix="<b>hbj</b>" %>
, you can use all HTMLB classes as tags in JSP.
I am not sure in which JSP you mean that every thing works fine with out this taglib!! But if you remove this taglib, then you cannot use HTMLB in this JSP.
http://help.sap.com/saphelp_nw2004s/helpdata/en/42/efdb279a563ee7e10000000a1553f7/frameset.htm
Greetings,
Praveen Gudapati
p.s Points are always welcome for helpful answers -
Hi
I'm developing portlets with JAVA EE 5, Tomcat 5.5.x and Spring Framework 2.0.
JSP + JSTL are used for views.
In my jsp pages I have a line
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
which work fine and I can use the core taglib and its tags.
However, if I read the Java EE 5 manual at http://java.sun.com/javaee/5/docs/tutorial/doc/JSPIntro9.html#wp73319 (at the end) it says that:
The absolute URIs for the JSTL library are as follows:
* Core: http://java.sun.com/jsp/jstl/core
This URI doesn't work for me. Is this a problem with Tomcat 5.5.9 or am I using wrong jar somewhere? I think jstl.jar is the one to look for - which version should I use and how do I know which version I have?
Error:
Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /WEB-INF/jsp/index.jsp(1,1) The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
with best regards FredrikThe difference is between JSTL1.0 and JSTL1.1
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> = JSTL1.0
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/jsp/core" %> = JSTL1.1
You can check the version by looking at the file Manifest.mf in the META-INF file of standard.jar or jstl.jar
You most probably have JSTL1.0 installed. -
Hi,
when I compile a JSP with this fisrt statement:
<%@ taglib prefix="foo" uri="/dir1/exampletag.tld" %>
the JDeveloper (v3.2) show the error:
"Start of root element expected".
Please, how can I resolve it?...
In my proyect:
My "HTML root directory" is:
C:\test\Html
and the "HTML source directory" is:
dir1
The file "exampletag.tld" is in:
C:\test\Html\dir1\exampletag.tld
Thank you very much.
AndresThanks for the answers, but it has not still worked.
I proved my tld file with a IE5 and it was read as an XML file without problem.
The classes that are used in the tld file are also compiled. I use now a only one directory as a source, rundebug, output and html proyect's path in order to find the file easily, but without success.
The examples that use DataTags.tld did not work neither. I read that a datatags "taglib jar file" must be added in the library proyect. Do you know the name of this jar file? There are many in the JDeveloper directory.
Thanks for any comment...
Andres
null -
OSB : Endpoint URI problem in business service
I have to invoke a http service from OSB where endpoint uri is http://<ip>:<port>/Resource.
At invocation time OSB is adding "?" to the end of URI, in that case http message is becoming like following:
POST /Resource? HTTP/1.1
External service is considering it as a bad request and giving 500 response code with following comments:
Error occured: 500, Cannot find local resource: /Resource?
But I am getting proper response when I am calling from java program with http message POST /Resource HTTP/1.1
It is not possible to change the external system, now how can I solve the problem??
Please help.
Thanks
Afzal
Edited by: uttam on May 2, 2012 9:49 PMOpen your business service and navigate to HTTP Transport configuration page and check what is the http type is enabled.
Look to me its with GET method, change it to POST and re-try.
If the above solution is not helping, try to check the Follow HTTP redirects check box below the Advanced Setting in same page.
Thanks,
Vijay -
How does the JSP container resolve taglib URI
My application uses JSPs which have taglibs. The taglibs use absolute URIs(http://java.sun.com/jstl/core). I noticed that if the JAR which would resolve this taglib, which is standard.jar, were to be placed in the <domain>/lib folder, the application would not be able to resolve it. If i packaged the JAR with the taglib definitions in the WEB-INF/lib folder of the WAR file, the application worked fine. Any clues on if this is expected behaviour? I have some other taglibs which refer to http://java.sun.com/jsf/html and jsf/core - these seem to be resolved fine by placing the jsf-impl.jar in the <domain>/lib folder.
Thanks
Ramdashello,
unfortunatly it is not quite clear what type of security you want to achieve ...
a) either securing the report for unauthorized running against different data
or
b) securing the stream between the server and the client using HTPPS
for case a) you will have to code the logic into the report so a user can only run the report against his data.
neither HTTPS nor the CGICMD.DAT can help you in this case. you could even use the row-level-security option of the database to achieve that.
regards,
the oracle reports team -
When to specify taglib uri in web.xml
When declaring a URI in the taglib directive, when must you include the taglib elements in web.xml, and when can you avoid them?
I tried putting a relative path to the .tld file, setting uri to �/WEB-INF/mysubfolder/myfile.tld�, but my web server complains that I�m missing a tlib-version element somewhere�
What is the uri path relative to, and in what cases must you include a mapping in web.xml and when do you not have to?
Thanks.So it sounds like your tld file has some invalid xml in it.
Double check the contents of your tld file.
If you declare a <uri> in your taglibrary, then you never need to declare it in web.xml.
You can just use that "well-known" uri to access your tag library.
The tld has to be either
1 - in the META-INF folder of a jar file deployed
2 - under the WEB-INF directory
See JSP specification section JSP.7.3.1 -
Taglib parsing problems when starting WLS 5.1 with user and region properties set to Turkish
Hi,
We are building an application for the Turkish market and we developed
custom tags to translate static text on JSP pages.
When WLS 5.1 is started with -Duser.region=TR and -Duser.language=tr, the
compilation of the pages doesn't work.
In fact, WL try to access a class called weblogic.servlet.jsp.stdtag.0nfo
which can't be found.
Turkish language has two kinds of 'i' letter and I have the impression that
weblogic is convering the I of info into another caracter and that it tries
to load the class with that specail caracter.
Does anyone has seen this already and what could we do to fix this problem ?
ThanksHi,
We are building an application for the Turkish market and we developed
custom tags to translate static text on JSP pages.
When WLS 5.1 is started with -Duser.region=TR and -Duser.language=tr, the
compilation of the pages doesn't work.
In fact, WL try to access a class called weblogic.servlet.jsp.stdtag.0nfo
which can't be found.
Turkish language has two kinds of 'i' letter and I have the impression that
weblogic is convering the I of info into another caracter and that it tries
to load the class with that specail caracter.
Does anyone has seen this already and what could we do to fix this problem ?
Thanks -
Hello,
I am attempting to compile a JSP using JSTL and am receiving the following:
CDShopCart/ProductList.jsp [-1:-1] This absolute uri (http://java.sun.com/jstl/core) cannot be resolved in either web.xml or the jar files deployed with this application.
I have imported the JSTL tag library JAR files into the Web Module. The files also appear to be mounted in the Java Studio Enterprise class path.
Any info. is much appreciated.
RyanSeems that you have no JSTL files deployed with your application.
Check your deployment to be sure that you have jstl, standard and so on jar files in WEB-INF/lib directory.
For Sun One Application server it will be in:
$ServerHome/domains/$DomainName/$ServerName/applications/j2ee-modules/$YouApplicationName_X/WEB-INF/lib -
Jsp taglib problems in J2ee server of j2sdkee1.3
Fresh from solving the problems with usebean in jsp, I again got a problem with the custom tags of JSP
I am using Jdk1.3 and j2sdkee1.3, windows98
The class file is stored in a package called my in the c:\j2sdkee1.3\lib\classes\my folder
and the tld and jsp file stored in c:\j2sdkee1.3\public_html folder
when I access the atm.jsp page, I got this error message
A Servlet Exception Has Occurred
org.apache.jasper.compiler.ParseException: End of content reached while more parsing required: tag nesting error?
Here is the ATMJsp.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>ATMJsp</shortname>
<info>a tag library for the atm details</info>
<tag>
<name>ATM</name>
<tagclass>my.atmtag</tagclass>
<bodycontent>JSP</bodycontent>
<info>Outputs of the ATM Counter</info>
</tag>
</taglib>
I try:
When I put the <bodycontent> tags below the <info> tags, I got the error message that the tag doesn't allow "bodycontent" here
I don't know what caused the problem ... is there some mistake in the above code?
Include other file to make it more clear---* atm.jsp and atmtag.java
atm.jsp
<%@ page import="my.atmtag" %>
<%@ taglib uri="ATMJsp.tld" prefix="atmjsp" %>
<%@ page errorPage="errorpage.jsp" %>
<!DocType HTML Public "-//W3C//DTD// HTML 4.0 Translational//EN">
<html>
<head></head>
<body>
<h3 align=center>ATM counters that need cash</h3>
<table><tr>
<td></td>
<td><atmjsp:ATM></td>
</tr>
</body>
</html>
atmtag.java
package my;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
import java.sql.*;
import java.math.*;
import java.util.*;
//tag handler
public class atmtag extends TagSupport
Connection connect=null;
Statement state=null;
ResultSet result=null;
public atmtag() throws ClassNotFoundException
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
public int doStartTag() throws JspTagException
return EVAL_BODY_INCLUDE;
public int doEndTag() throws JspTagException
try
JspWriter out=pageContext.getOut();
connect=DriverManager.getConnection("jdbc:odbc:EarnestBank","","");
String strquery="select cCounter_id, cAddress, mCashBalance from Counter where mCashBalance<=10000";
state=connect.createStatement();
ResultSet result=state.executeQuery(strquery);
String sid=null;
String saddress=null;
String sbalance=null;
Vector v=new Vector();
while(result.next())
sid=result.getString(1);
saddress=result.getString(2);
sbalance=result.getString(3);
v.add(sid);
v.add(saddress);
v.add(sbalance);
for (int i=0; i<v.size();i++)
String str=(String)v.elementAt(i);
pageContext.getOut().write(str);
catch(Exception ex)
return EVAL_PAGE;
Pls help me to get through this hurdle
Thanks1) To handle <bodycontent> you should inherit from BodyTagSupport
class
2) You should use your bean like: <td><atmjsp:ATM/></td>
with closing slash - it's bodyless tag - this mistake
causes JSP compiler to report error
Enjoy!
Paul -
I'm using JFreeChart to display the chart and I define the following taglib in my JSP.
<%@ taglib uri="/WEB-INF/chartlib.tld" prefix="chartlib" %>
It works in Tomcat and WebLogic, but not webtogo, got this exception.
java.lang.NoClassDefFoundError: Illegal name: /WEB-INF/chartlib.tld
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at oracle.lite.web.ServletHandler$ServletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at oracle.jsp.parse.JspUtils.loadClassJDK(JspUtils.java:219)
at oracle.jsp.parse.JspUtils.loadClass(JspUtils.java:209)
I have to hardcode the app name in order to make it work. Is there any good solution?
<%@ taglib uri="//webapp/WEB-INF/chartlib.tld" prefix="chartlib" %>
And it just solve the exception problem, it actually cannot show the chart. Anyone use the jfreechart or has problem in using custom tag library?
MatthewI put the chartlib.tld in /WEB-INF/ and here is my web.xml. The uri of the taglib directive in JSP is exactly the taglib-uri here for each case.
<taglib>
<taglib-uri>/WEB-INF/chartlib.tld</taglib-uri>
<taglib-location>/WEB-INF/chartlib.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>chartlib-01.tld</taglib-uri>
<taglib-location>/chartlib.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>chartlib-02.tld</taglib-uri>
<taglib-location>/no_chartlib.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>chartlib-03.tld</taglib-uri>
<taglib-location>/WEB-INF/chartlib.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>chartlib-04.tld</taglib-uri>
<taglib-location>chartlib.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>chartlib-05.tld</taglib-uri>
<taglib-location>no_chartlib.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB/chartlib.tld</taglib-uri>
<taglib-location>/WEB-INF/chartlib.tld</taglib-location>
</taglib>
And I have modified the source code in JspDirectiveTaglib.java to output some debug message, where s1 is the value of uri in JSP, s3 is the value of taglib-location in web.xml. Here is the result. It tries to load s1 first. If it returns null, then it reads the tld file s2. It shows that the leading '/' represent the webapp dir. If it is relative (i.e. no '/'), it refers to the /WEB-INF as you can see the program automatically add it in the beginning. Finally, the message "loader MyChartTag" shows that it loads my tag class successfully.
----Case 1: this should be the normal/ideal case, but in fact it fails.
----It loads the tld file but it is not a class, so throws the error.
JspDirectiveTaglib:uri(s1)=[WEB-INF/chartlib.tld]
JspDirectiveTaglib:s3=[WEB-INF/chartlib.tld]
JspDirectiveTaglib:loadClass(s1)=[WEB-INF/chartlib.tld]
log1: loader: /WEB-INF/chartlib.tld
log9: JspServlet: unable to dispatch to requested page: java.lang.NoClassDefFoundError:
Illegal name: /WEB-INF/chartlib.tld
----Case 2: try to read tld in root dir.
JspDirectiveTaglib:uri(s1)=[chartlib-01.tld]
JspDirectiveTaglib:s3=[chartlib.tld]
JspDirectiveTaglib:loadClass(s1)=[chartlib-01.tld]
JspDirectiveTaglib:class1=null
log9: JspServlet: unable to dispatch to requested page: oracle.jsp.parse.JspParseException:
Error: java.io.FileNotFoundException:
F:\webapp\chartlib.tld (???????????)
----Case 3: try to read a non-existing tld to see where is the root dir.
JspDirectiveTaglib:uri(s1)=[chartlib-02.tld]
JspDirectiveTaglib:s3=[no_chartlib.tld]
JspDirectiveTaglib:loadClass(s1)=[chartlib-02.tld]
JspDirectiveTaglib:class1=null
log9: JspServlet: unable to dispatch to requested page: oracle.jsp.parse.JspParseException:
Error: java.io.FileNotFoundException:
F:\webapp\no_chartlib.tld (???????????)
----Case 4: try to read tld in absolute dir.
JspDirectiveTaglib:uri(s1)=[chartlib-03.tld]
JspDirectiveTaglib:s3=[WEB-INF/chartlib.tld]
JspDirectiveTaglib:loadClass(s1)=[chartlib-03.tld]
JspDirectiveTaglib:class1=null
log1: loader: MyChartTag
----Case 5: try to read tld in relative dir, but the path is changed by the program.
JspDirectiveTaglib:uri(s1)=[chartlib-04.tld]
JspDirectiveTaglib:s3=[WEB-INF/chartlib.tld]
JspDirectiveTaglib:loadClass(s1)=[chartlib-04.tld]
JspDirectiveTaglib:class1=null
log1: loader: MyChartTag
----Case 6: try to read a non-existing tld in relative dir, but the path is changed by the program.
JspDirectiveTaglib:uri(s1)=[chartlib-05.tld]
JspDirectiveTaglib:s3=[WEB-INF/no_chartlib.tld]
JspDirectiveTaglib:loadClass(s1)=[chartlib-05.tld]
JspDirectiveTaglib:class1=null
log9: JspServlet: unable to dispatch to requested page: oracle.jsp.parse.JspParseException:
Error: java.io.FileNotFoundException:
F:\webapp\WEB-INF\no_chartlib.tld (???????????)
----Case 7: try to compare to case 1 if the uri specifies an invalid path.
JspDirectiveTaglib:uri(s1)=[WEB/chartlib.tld]
JspDirectiveTaglib:s3=[WEB-INF/chartlib.tld]
JspDirectiveTaglib:loadClass(s1)=[WEB/chartlib.tld]
JspDirectiveTaglib:class1=null
log1: loader: MyChartTag -
Jdev 10.1.2 problem define jstl tagLib
hi,
i have a problem in my jsp when i compile it with JDev 10.1.2, when trying to use JSTL tag:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
I always get the following message:
Error(3,49): Attribute 'xmlns' used but not declared.
Error(4,58): Attribute 'xmlns:xsi' used but not declared.
Error(5,105): Attribute 'xsi:schemaLocation' used but not declared.
Error(6,18): Attribute 'version' used but not declared.
Error(33,19): Invalid element 'context-param' in content of 'web-app', expected elements '[resource-ref, security-constraint, login-config, security-role, env-entry, ejb-ref, ejb-local-ref]'.
Error(34,18): Invalid element 'description' in content of 'context-param', expected elements '[param-name]'.
but i saw this tutorial http://www.oracle.com/technology/products/jdev/tips/schalk/taglibs/taglibs.html
and i check my preferences about my projet, i had the libraries standart.jar and jstl.jar to my project (Project Properties->Profile->developement->Libraries), and they are located in my <project>/public_html/WEB-INF/lib/
And for the declaration of the taglib,
Tools->Manage Libraries-> JSP TagLibraries the prefix "c" is defined, and it is the same uri what i'm using in my jsp.
I make another with jdev 10.1.3, and i put my project, i compile and it work very fine.
Thanks for any help.
Regis.Hi this is my Web.xml
I do not have a DTD with the web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>jGallery</display-name>
<context-param>
<param-name>useDataBase</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>dataSource</param-name>
<param-value>java:comp/env/jdbc/jGallery</param-value>
</context-param>
<context-param>
<param-name>thumbnailWriter</param-name>
<param-value>de.jwi.jgallery.toolkit.ToolkitThumbnailWriter</param-value>
</context-param>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/jGallery</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<context-param>
<description>separate with commas</description>
<param-name>dirmappings</param-name>
<param-value>/=D:/temp/jg</param-value>
</context-param>
<servlet>
<servlet-name>Controller</servlet-name>
<servlet-class>de.jwi.jgallery.servlets.Controller</servlet-class>
<init-param>
<description>Path prefix, that maps to web ressources</description>
<param-name>webprefix</param-name>
<param-value>/web/</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>StatisticsController</servlet-name>
<servlet-class>de.jwi.jgallery.servlets.StatisticsController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Controller</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>StatisticsController</servlet-name>
<url-pattern>/Statistics/*</url-pattern>
</servlet-mapping>
<!--
<security-constraint>
<web-resource-collection>
<web-resource-name>jGallery</web-resource-name>
<url-pattern>/Statistics</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Example Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/security/login.jsp</form-login-page>
<form-error-page>/security/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>manager</role-name>
</security-role>
-->
<welcome-file-list>
<welcome-file>jGallery.htm</welcome-file>
</welcome-file-list>
<jsp-config>
<taglib>
<taglib-uri> http://www.jwi.de/jGallery/taglib </taglib-uri>
<taglib-location> /WEB-INF/jGallery.tld </taglib-location>
</taglib>
</jsp-config>
</web-app>
I'm not using the JSTL 1.1, in the "management libraries"
i define a JSTL librarie and the version is 1.0.
Maybe you are looking for
-
Is there no Hyper-V on Windows 8.1 professional?
Hi All, I turn Hyper-V feature on as the following: Then restart computer. But I still don't find Hyper-V. Does anybody know why?
-
How to backup data from old droid to turbo?
The turbo is not listed for new devices. How do you backup data from old droid to new turbo?
-
How to re(download) lion 10.7 when already updated to Mt. Lion 10.8
Is there any way to re(download) 10.7 from App Store after I have installed 10.8? I do NOT have any (imaged) backup of my system with 10.7 installed (i.e. superduper, or time machine images) and when I attempt to re download it (the 10.7 app) from A
-
Wiring for Power adapter?
I have a 90w power adapter from an older notebook that will work with my HP DV5-1015nr. I transport my notebook between home and office. I'd like to utilize the older power brick, so that I won't need to transport a power brick back and forth. The ti
-
I am continually getting error -69 when syncing iPad Air with latest iOS and iTunes versions. Any suggestions?