【问题标题】:Runtime error when integrating Struts2-Jquery Plugin Datepicker with Netbeans 7.1将 Struts2-Jquery 插件 Datepicker 与 Netbeans 7.1 集成时出现运行时错误
【发布时间】:2012-04-19 14:41:42
【问题描述】:

我将 Netbeans IDE v7.1 + Struts 2/XWork 插件与 Struts 2.2.3 库和 Glassfish Server v3 一起使用 http://plugins.netbeans.org/plugin/39218

我还从这里集成了 Struts2-Jquery 插件: Plugin Page at Google Code

我下载的文件是:struts2-jquery-plugin-3.3.0.jar

首先,我将它作为 JAR/文件夹库添加到项目中。

接下来,我将示例代码复制到一个 JSP 页面中,结构如下:

            <%-- 
                Document   : calendarDemo
                Created on : 18-abr-2012, 17:48:08
                Author     : David32
            --%>

            <%@ taglib prefix="s" uri="/struts-tags"%>
            <%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
            <html>
              <head>
                <sj:head locale="es" jquerytheme="lightness"/>
                <title>Datepicker Demo</title>
              </head>
              <body>
                <s:form id="form" theme="xhtml">
                  <sj:datepicker id="date0" name="date0" label="With Button Panel" showButtonPanel="true"/>
                  <sj:datepicker id="date1" name="date1" label="Change Month and Year" changeMonth="true" changeYear="true"/>
                  <sj:datepicker id="date2" name="date2" label="Custom Button Text" showOn="both" buttonText="Select a Date"/>
                  <sj:datepicker id="date3" name="date3" label="Show only on Button Click" showOn="button"/>
                  <sj:datepicker id="date4" name="date4" label="Text after selection" appendText=" (dd.MM.yy)" displayFormat="dd.MM.yy"/>
                  <sj:datepicker id="date5" name="date5" label="With fast slideDown Animation" showAnim="slideDown" duration="fast"/>
                  <sj:datepicker id="date6" name="date6" label="With slow fadeIn Animation" showAnim="fadeIn" showOptions="{direction: 'up' }" duration="slow" />
                  <sj:datepicker id="date7" name="date7" label="Show 3 Months" numberOfMonths="3"/>
                  <sj:datepicker id="date8" name="date8" label="Show Month Array" numberOfMonths="[2,3]"/>
                  <sj:datepicker id="date9" name="date9" label="Show Years only from 2008 until 2012" yearRange="2008:2012" changeYear="true"/>
                  <sj:datepicker id="date10" name="date10" label="Button Only" buttonImageOnly="true"/>
                  <sj:datepicker id="date11" name="date11" label="Without Button" showOn="focus"/>
                  <sj:datepicker id="date12" name="date12" label="With Close Event" onClose="onClose"/>
                </s:form>
              </body>
            </html>

web.xml中配置的起始页当然是[b]calendars/calendarDemo.jsp[/b]

Netbeans 未检测到任何错误,因为正确检测并检查了 Datepicker 标记。 另一方面,在部署后它只给出一个错误 500 页面,并带有以下通知:

            org.apache.jasper.JasperException: 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]

有人知道我在配置这个插件时是否缺少什么吗?任何帮助将不胜感激!

我很乐意将整个异常日志粘贴到另一个帖子中,因为当前帖子已经太长了。

【问题讨论】:

  • 当你得到这个异常时你点击了什么 URL?我怀疑你是直接点击jsp页面??
  • 我点击了:localhost:8080/TelesismuxWeb 这是 App Container (Glassfish) 正在监听的位置。我已经用其他 JSP 作为起始页进行了测试,它们可以完美加载。
  • 您在 web.xml 中配置了过滤器 diapatcher?
  • 亲爱的 Umesh:我用谷歌搜索了很多,但找不到一致的答案。有人说只需要在 JSP 中编写以下使用标签的指令: 另一方面,我读过这个链接:struts.apache.org/2.0.6/docs/webxml.html 在最后一部分它说不建议在 web.xml 中声明 taglibs。我很困惑。我对 Struts2 有点陌生。任何建议将不胜感激。
  • 不,你不需要在你的web.xml中声明标签库。如果你想使用struts2标签使用&lt;%@ taglib prefix="s" uri="/struts-tags"%&gt;,如果你想使用jquery标签使用&lt;%@ taglib prefix="sj" uri="/struts-jquery-tags"%&gt;。确保您已经在 web.xml 文件中配置了 struts2 过滤器调度程序。此外,请使用 web.xml 和类路径中的库更新您的帖子

标签: jquery netbeans struts2 struts


【解决方案1】:

正如用户@Umesh Awasthi 所说,这是plugin 的一个已知问题。

解决方法是降级到插件的 3.2.1 版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-08
    • 2020-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多