繁体   English   中英

Struts-异常-找不到Struts调度程序

[英]Struts - Exception - The Struts dispatcher cannot be found

我正在使用Struts 2.1.8.1 我想在我的jsp页面中使用struts提供的标签。 例如

<%@ 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>

但是,当我运行上面的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)

不能将Struts 2标记与Struts 1一起使用。Struts 2来自WebWorks项目,并且与Struts 1向后不兼容。

  • Struts 1与Actions一起使用
  • Struts 2可与过滤器和调度程序一起使用。

因此,为什么要这样做:

找不到Struts调度程序。 这通常是由于使用不带关联过滤器的Struts标记引起的。 仅当请求已通过其Servlet过滤器(该过滤器初始化此标签所需的Struts调度程序)时,Struts标记才可用。 -[未知位置]

获得Struts 1标记库并替换Struts 2标记库。

在这里按照我对您的问题的回答: Struts-Struts为.tld提供的JSP页面中的Taglib指令

编辑一个好的教程站点:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM