【发布时间】:2012-01-16 16:22:50
【问题描述】:
截至 2011 年 1 月 16 日,我已经下载了最新版本的 tomcat 7,即 7.0.23。我发现我的 jakarta 标记库组件都没有在 jsps 中工作。每个jsp中的故障点都是相同且一致的。这是
org.apache.taglibs.input.Select _jspx_th_input_005fselect_005f0 = (org.apache.taglibs.input.Select)_jsp_instancemanager.newInstance("org.apache.taglibs.input.Select", this.getClass().getClassLoader());
我还写了一个自定义标签来看看它是否工作,我也遇到了同样的问题。
com.ah.util.customtags.SelectTag _jspx_th_hirezon_005fform_005fselect_005f0 = (com.ah.util.customtags.SelectTag)_jsp_instancemanager.newInstance("com.ah.util.customtags.SelectTag", this.getClass().getClassLoader());
jsp代码是
<%@ page extends="com.ah.servlets.BaseJSPServlet"%>
<%@ taglib uri="/WEB-INF/hirezon_form.tld" prefix="hirezon_form" %>
<html>
<body>Test tags
<%
System.setProperty("org.apache.jasper.Constants.USE_INSTANCE_MANAGER_FOR_TAGS", "true");
%>
<hirezon_form:select count="100"/>
</body>
</html>
CustomTagSupport 类的代码是
package com.ah.util.customtags;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
public class SelectTag extends TagSupport {
String count;
public String getCount() {
return count;
}
public void setCount(String count) {
this.count = count;
}
public int doStartTag() throws JspException {
// This means the JSP must evaluate the contents of any CHild tags
// in this tag;
return EVAL_BODY_INCLUDE;
}
// This method is called when the JSP encounters the end of te tag
// implemented by this class
public int doEndTag() throws JspException {
String sum = "200000";
try {
pageContext.getOut().write("The Sum of first " + count + " numbers is " + sum);
} catch (IOException e) {
throw new JspException("Fatal Error: HelloTag could'nt write to the JSP out");
}
// This return type tells the JSP page to continue processing
// the rest of the page
return EVAL_PAGE;
}
}
Tomcat 7.0.23 中是否存在已知错误?我做了很多研究,还尝试将 USE_INSTANCE_MANAGER_FOR_TAGS 属性设置为 true,但我仍然遇到同样的错误。任何建议将不胜感激,谢谢
【问题讨论】: