2013-07-05 56 views
1

我有一個jsp的樣子。Spring 3.2.2 + Tiles3 + i18n找不到

<%@page contentType="text/html" pageEncoding="UTF-8"%> 
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> 

     <div class="container-fluid"> 

      <div class="logo row-fluid"> 

       <div class="span12"> 

        <img src="<c:url value="/img/logo.png"/>" /> 

       </div> 

      </div> 

      <div class="row-fluid"> 

       <div class="span6"> 

        <form> 

         <fieldset> 

          <legend></legend> 

         </fieldset> 

        </form> 

       </div> 

       <div class="span6"> 

        <form> 

         <fieldset> 

          <legend><spring:message code="home.form.legend.local"/></legend> 

         </fieldset> 

        </form> 

       </div> 

      </div> 

     </div> 

隨着<spring:message />標籤與此消息的jsp破:org.springframework.web.util.NestedServletException:請求處理失敗;嵌套異常是org.apache.tiles.request.render.CannotRenderException:包含路徑'/WEB-INF/jsp/public_layout.jsp'的ServletException。

如果刪除<spring:message />標籤運行沒有問題。

XXX-servlet.xml中配置:

<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> 
    <property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/> 
</bean> 

<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"> 
    <property name="definitions"> 
     <list> 
      <value>/WEB-INF/tiles.xml</value> 
     </list> 
    </property> 
</bean> 

tiles.xml:

<tiles-definitions> 

    <definition name="public.layout" template="/WEB-INF/jsp/public_layout.jsp"> 
     <put-attribute name="header" value="/WEB-INF/jsp/header.jsp" /> 
     <put-attribute name="body" value="" /> 
     <put-attribute name="footer" value="/WEB-INF/jsp/footer.jsp" /> 
    </definition> 

    <definition name="home" extends="public.layout"> 
     <put-attribute name="body" value="/WEB-INF/jsp/home.jsp" /> 
    </definition> 

</tiles-definitions> 

public_layout.jsp:

<%@taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %> 
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> 

<tiles:insertAttribute name="header" /> 

<tiles:insertAttribute name="body" /> 

<tiles:insertAttribute name="footer" /> 

控制器:

@RequestMapping({"/", "/index"}) 
public String showHome() { 

    return "home"; 
} 

回答

0

org.springframework.web.util.NestedServletException:請求處理失敗;嵌套異常是org.apache.tiles.request.render.CannotRenderException:包含路徑'/WEB-INF/jsp/public_layout.jsp'的ServletException。

這隻能說,有在public_layout.jsp 錯誤應該有另一個錯誤更具體的<spring:message />失敗

+1

MCK您好,我用FMT標籤庫,而不是春天taglig解決的問題。感謝您的關注。 ;) – Dani

相關問題