1

我是新来的struts。我将在我的 Java EE 项目中使用 struts tile。我阅读了说明如何使用瓷砖的以下页面。
struts 瓦片示例

我阅读了该页面并尝试执行该页面中提到的所有事情。在下面,您可以详细了解我的文件。

struts-config.xml:

<plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
    <set-property property="moduleAware" value="true" />
</plug-in>  

瓷砖-defs.xml:

<tiles-definitions>
<definition name="role.list" path="/WEB-INF/content/layout.jsp">
    <put name="body" value="/WEB-INF/content/admin/restricted/role_list_body.jsp"
        type="page" />
</definition>

role_list_body.jsp:

<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>Insert title here</title>
   </head>
   <body>
      List of Roles
   </body>
</html>

而 role_list.jsp 是:

<body>
   <sTile:insert beanName="role.list"/>
</body>

我认为所有的事情都是正确的。但是当我调用 role_list.jsp 我得到以下错误:

type Exception report

message

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

exception

org.apache.jasper.JasperException: javax.servlet.ServletException:  javax.servlet.jsp.JspException: Error - Tag Insert : No value defined for bean 'role.list' with property 'null' in scope 'null'.
          org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:534)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:442)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Error - Tag Insert : No value defined for bean 'role.list' with property 'null' in scope 'null'.
     org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
    org.apache.jsp.WEB_002dINF.content.admin.restericted.role.role_005flist_jsp._jspService(role_005flist_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause

javax.servlet.jsp.JspException: Error - Tag Insert : No value defined for bean 'role.list' with property 'null' in scope 'null'.
org.apache.struts.tiles.taglib.InsertTag.processBean(InsertTag.java:667)
org.apache.struts.tiles.taglib.InsertTag.createTagHandler(InsertTag.java:483)
org.apache.struts.tiles.taglib.InsertTag.doStartTag(InsertTag.java:441)
    org.apache.jsp.WEB_002dINF.content.admin.restericted.role.role_005flist_jsp._jspx_meth_sTile_005finsert_005f0(role_005flist_jsp.java:97)
    org.apache.jsp.WEB_002dINF.content.admin.restericted.role.role_005flist_jsp._jspService(role_005flist_jsp.java:70)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.12 logs.

你知道这个问题是怎么回事吗?
谢谢。

4

1 回答 1

0

我发现问题。
在 role_list.jsp 我替换
<sTile:insert beanName="role.list" /><sTile:insert definition="role.list" />

现在它确实有效。

于 2013-03-17T13:53:03.823 回答