我有一个jsp外观。
<%@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:ServletException,包括路径'/WEB-INF/jsp/public_layout.jsp'。
如果删除<spring:message />
标记没有问题。
xxx-servlet.xml config:
<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 :(得分:0)
org.springframework.web.util.NestedServletException:请求处理失败;嵌套异常是org.apache.tiles.request.render.CannotRenderException:ServletException,包括路径'/WEB-INF/jsp/public_layout.jsp'。
这只表示public_layout.jsp中存在错误
应该有一个更具体的<spring:message />
失败错误