0

现在我开始学习 Struts 2 jQuery sj: tag。以下代码是从网站复制的。

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="/struts-tags" prefix="s"%>
    <%@ taglib uri="/struts-jquery-tags" prefix="sj"%>
    <!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>Insert title here</title>
    </head>
    <body>
    <s:form action="sample" theme="bootstrap" cssClass="form-horizontal" label="Form with jQuery UI Elements">
            <sj:datepicker id="datepicker" parentTheme="bootstrap" label="Datepicker" tooltip="Tooltip for Datepicker"/>
            <s:url id="language_url" action="languages" />
            <sj:autocompleter id="autocompleter" parentTheme="bootstrap" label="Autocompleter" tooltip="Tooltip for Autocompleter" href="%{languages_url}" loadMinimumCount="1"/>
          </s:form>
    </body> 
    </html>

发生此错误请告诉我我是 struts 2 jQuery 的初学者

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Template /template/bootstrap/form-close.ftl not found. - Class: freemarker.template.Configuration
File: Configuration.java
Method: getTemplate
Line: 580 - freemarker/template/Configuration.java:580:-1
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:413)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)

root cause

Template /template/bootstrap/form-close.ftl not found. - Class: freemarker.template.Configuration
File: Configuration.java
Method: getTemplate
Line: 580 - freemarker/template/Configuration.java:580:-1
    org.apache.struts2.components.UIBean.end(UIBean.java:515)
    org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
    org.apache.jsp.pages.samplePage1_jsp._jspx_meth_s_005fform_005f0(samplePage1_jsp.java:262)
    org.apache.jsp.pages.samplePage1_jsp._jspService(samplePage1_jsp.java:104)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)

root cause

java.io.FileNotFoundException: Template /template/bootstrap/form-close.ftl not found.
    freemarker.template.Configuration.getTemplate(Configuration.java:580)
    freemarker.template.Configuration.getTemplate(Configuration.java:543)
    org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:96)
    org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559)
    org.apache.struts2.components.UIBean.end(UIBean.java:513)
    org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
    org.apache.jsp.pages.samplePage1_jsp._jspx_meth_s_005fform_005f0(samplePage1_jsp.java:262)
    org.apache.jsp.pages.samplePage1_jsp._jspService(samplePage1_jsp.java:104)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:88)*
4

1 回答 1

0

它无法找到引导主题文件。尝试使用其他主题,例如 xhtml 或 css_xhtml。它将运行您的代码。还要从任何地方删除该父主题属性。尝试运行最简单的代码。一旦这很清楚,你可以尝试复杂的。

于 2013-10-14T08:24:13.273 回答