我在用Struts 2.1.8.1
.我想使用struts
我的jsp页面提供的标签.例如
<%@ taglib prefix="html" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Transfer Program - Login</title>
</head>
<body>
<html:form action="/loginaction.do" method="post">
Username:<html:text name="username"></html:text>
</html:form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是当我运行上面的jsp页面时,我收到以下错误:
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
Run Code Online (Sandbox Code Playgroud)
你不能在Struts 1中使用Struts 2标签.Struts 2来自WebWorks项目,它不能与Struts 1向后兼容.
因此,为什么你得到这个:
找不到Struts调度程序.这通常是由于使用没有关联过滤器的Struts标记引起的.Struts标记仅在请求通过其servlet过滤器时可用,该过滤器初始化此标记所需的Struts调度程序. - [未知位置]
获取Struts 1 taglib并替换Struts 2 taglib.
请按照我在这里提出的问题的答案:Struts - Struts中提供的.tld的JSP页面中的Taglib指令
编辑一个很好的教程网站:
归档时间: |
|
查看次数: |
19272 次 |
最近记录: |