You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John MccLain <jm...@tcshealthcare.com> on 2005/05/27 18:59:58 UTC
Why no paramters in TLD function???
This is strange,
I have a jsp that accessess a function declared in a TLD file. The function
has NO paramters passed to it. When I try to compile the jsp into a servlet
via tomcat jasper, I get:
C:\Tomcat\webapps\Acuity\build.xml:98: org.apache.jasper.JasperException:
The class specified in the method signature in TLD for the function
rules:getAutoRefresh1 cannot be found.
OK - but I have done this before a million times and I know it works, so I
looked at working examples of my code where I did this and the only
difference is that this function takes no parameters. So for an experiment,
I changed the TLD, the jsp and the class to have a dummy int parmater passed
to the function - not used just passed - AND IT COMPILED!?! WHY DOES IT
MATTER IF THERE ARE PARAMTERS OR NOT - AM I DOING SOMETHING WRONG??? IS IT
BECAUSE IT IS A GET METHOD???
here is the test jsp and .tld file
THIS DOESNT WORK...
JSP
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="rules" uri="/WEB-INF/tlds/rules.tld" %>
<%@ page isELIgnored="false" %>
<c:set var="autoRefresh" value="${rules:getAutoRefresh1()}" />
<html>
<head>
</head>
<body>
</body>
</html>
RULES.TLD
<?xml version="1.0" encoding="UTF-8" ?>
<taglib 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/j2eeweb-jsptaglibrary_2_0.x
sd"
version="2.0">
<description>TCS Rule Engine Library</description>
<display-name>TCS Rule Engine Functions</display-name>
<tlib-version>1.0</tlib-version>
<short-name>rules</short-name>
<uri>/WEB-INF/tags/Rules.tld</uri>
<function>
<name>getAutoRefresh1</name>
<description>
Retrieves the auto refresh token setting
</description>
<function-class>tcsServices.RulesMgr</function-class>
<function-signature>java.lang.String
GetAutoRefresh1()</function-signature>
</function>
</taglib>
CODE
public static String GetAutoRefresh1()
{
String refresh = "N";
if( autoRefresh )
{
refresh = "Y";
}
return refresh;
}
THIS WORKS?!?....
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="rules" uri="/WEB-INF/tlds/rules.tld" %>
<%@ page isELIgnored="false" %>
<c:set var="autoRefresh" value="${rules:getAutoRefresh1(1)}" />
<html>
<head>
</head>
<body>
</body>
</html>
RULES.TLD
<?xml version="1.0" encoding="UTF-8" ?>
<taglib 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/j2eeweb-jsptaglibrary_2_0.x
sd"
version="2.0">
<description>TCS Rule Engine Library</description>
<display-name>TCS Rule Engine Functions</display-name>
<tlib-version>1.0</tlib-version>
<short-name>rules</short-name>
<uri>/WEB-INF/tags/Rules.tld</uri>
<function>
<name>getAutoRefresh1</name>
<description>
Retrieves the auto refresh token setting
</description>
<function-class>tcsServices.RulesMgr</function-class>
<function-signature>java.lang.String
GetAutoRefresh1(int)</function-signature>
</function>
</taglib>
CODE
public static String GetAutoRefresh1(int i)
{
String refresh = "N";
if( autoRefresh )
{
refresh = "Y";
}
return refresh;
}
John McClain
Senior Software Engineer
TCS Healthcare
jmcclain@tcshealthcare.com
(530)886-1700x235
"Skepticism is the first step toward truth"
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org