Struts-异常-找不到Struts调度程序 [英] Struts - Exception - The Struts dispatcher cannot be found

查看:231
本文介绍了Struts-异常-找不到Struts调度程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using Struts 2.1.8.1. I want to use tags, supplied by struts, im my jsp pages. 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)

推荐答案

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

You cannot use Struts 2 tags with Struts 1. Struts 2 is from the WebWorks project and it's not backward compatible with Struts 1.

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

为什么会这样:

找不到Struts调度程序. 这通常是由于使用Struts引起的 没有关联过滤器的代码. 只有在以下情况下,Struts标记才可用 请求已通过其servlet 过滤器,用于初始化Struts 此标记所需的调度程序. -- [未知位置]

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]

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

Get the Struts 1 taglibs and replace the Struts 2 taglibs.

在这里按照您的问题回答我的问题:

Follow my answer from your question here: Struts - Taglib directive in a JSP page for .tld provided by Struts

编辑一个很好的教程网站:

Edit A good tutorial site:

  • http://wiki.apache.org/struts/StrutsTutorials
  • http://www.roseindia.net/struts/. Here it explains what Actions, Plugins, Tags, Validation, mappings, etc. works and how to use them. Read on Struts 1 and not Struts 2.

这篇关于Struts-异常-找不到Struts调度程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆