Tabbedpanel使用Struts2-JQuery

时间:2012-09-25 09:29:26

标签: jquery jsp struts2 struts2-jquery

在我的jsp中使用jquery创建tabbedpanel,其错误类似于

我的代码是:

 <%@ taglib prefix="s" uri="/struts-tags"%>
 <%@ taglib uri="/struts-jquery-tags" prefix="sj" %>
 <html>
   <head>
     <sj:head debug="true"/>
   </head>
   <body>
<sj:tabbedpanel id="mytabs" collapsible="true" useSelectedTabCookie="true">

  <sj:tab id="tab1" target="tone" label="Tab One"/>
  <sj:tab id="tab2"  target="ttwo" label="Tab Two"/>
  <sj:tab id="tab3"  target="tthree" label="Tab Three"/>
  <div id="tone"> Test 1 </div>
  <div id="ttwo"> Test 2 </div>
  <div id="tthree"> Test 3 </div>
</sj:tabbedpanel>
  </body>
</html>

错误:

**FreeMarker template error!**

Error reading included file template/simple/dynamic-attributes.ftl

有问题的指示:

 include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" [on line 31, column 1 in template/jquery/tabbedpanel.ftl]

程序员的Java回溯:

----------
freemarker.template.TemplateException: Error reading included file template/simple/dynamic-attributes.ftl
    at freemarker.core.Include.accept(Include.java:167)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.Environment.process(Environment.java:199)
    at freemarker.template.Template.process(Template.java:237)
    at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:168)
    at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:530)
    at org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:58)
    at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:54)
    at org.apache.jsp.WEB_002dINF.pages.three_jsp._jspx_meth_sj_005ftabbedpanel_005f0(three_jsp.java:116)
    at org.apache.jsp.WEB_002dINF.pages.three_jsp._jspService(three_jsp.java:69)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:371)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: Template template/simple/dynamic-attributes.ftl not found.
    at freemarker.template.Configuration.getTemplate(Configuration.java:495)
    at freemarker.core.Environment.getTemplateForInclusion(Environment.java:1490)
    at freemarker.core.Include.accept(Include.java:157)
    ... 34 more

1 个答案:

答案 0 :(得分:0)

该异常表明您缺少文件。您可能没有项目中包含的所有struts 2库。请查看API以了解您正在使用的struts版本,以了解有关所需文件的更多信息。

对于struts 2 Jquery,你需要jquery插件,如:

<dependency>
<groupId>com.jgeppert.struts2.jquery</groupId>
<artifactId>struts2-jquery-plugin</artifactId>
<version>3.3.3</version>

如果您手动下载它们,请在“Maven Repository + struts2-jquery-plugin”上进行Google搜索。