Struts - 异常 - 无法找到Struts调度程序

时间:2010-03-07 05:59:40

标签: java jsp struts

我正在使用Struts 2.1.8.1。我想使用struts提供的标签,即我的jsp页面。 e.g

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

1 个答案:

答案 0 :(得分:5)

不能使用Struts 2标签和Struts 1. Struts 2来自WebWorks项目,它不能向后兼容Struts 1.

  • Struts 1适用于Actions
  • Struts 2适用于过滤器和调度程序。

为什么你得到这个:

  

找不到Struts调度程序。   这通常是由使用Struts引起的   没有关联过滤器的标签。   Struts标签仅在使用时才可用   请求已通过其servlet   filter,初始化Struts   此标记需要调度程序。 -   [未知位置]

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

请点击我的问题答案:Struts - Taglib directive in a JSP page for .tld provided by Struts

编辑一个好的教程网站:

相关问题