我搜索了该网站上提出的所有问题,并尝试了所有更改,但没有运气。所以在这里发布查询: 尝试连接Apache Tiles,但Tiles无法看到属性
我的spring-mvc.xml
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<mvc:annotation-driven/>
<context:component-scan base-package="ru.clients.**.web"/>
<mvc:resources mapping="/resources/**" location="/resources/"/>
<!-- use WebJars so Javascript and CSS libs can be declared as Maven dependencies (Bootstrap, jQuery...) -->
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:validation</value>
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<!-- Apache Tiles-->
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles/tiles.xml</value>
</list>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/>
</bean>
</beans>
我的控制器
@Controller
public class UIController {
private final Logger log = LoggerFactory.getLogger(getClass());
@GetMapping(value = {"/", "/welcome"})
@ResponseStatus(value = HttpStatus.OK)
public String welcome() {
return "/pages/welcome";
}
@GetMapping("/auth")
@ResponseStatus(value = HttpStatus.OK)
public String auth(Model model) {
UserTo userTo = new UserTo();
model.addAttribute("userForm", userTo);
return "auth";
}
}
我的tile.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<!-- Base Define -->
<definition name="common" template="/WEB-INF/jsp/pages/layout.jsp">
<put-attribute name="slideIcons" value="/WEB-INF/jsp/fragments/slideIcons.jsp"/>
<put-attribute name="form" value="/WEB-INF/jsp/fragments/form.jsp"/>
<put-attribute name="authFooterForm" value="/WEB-INF/jsp/fragments/authFooterForm.jsp"/>
<put-attribute name="footer" value="/WEB-INF/jsp/fragments/footer.jsp"/>
</definition>
<!-- Login Page -->
<definition name="auth" extends="common">
<put-attribute name="title" value="Login Form"/>
</definition>
</tiles-definitions>
我的layout.jsp
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="tilesx" uri="http://tiles.apache.org/tags-tiles-extras" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="resources/css/style.css">
<script type="text/javascript" src="webjars/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript" src="resources/js/scripts.js" defer></script>
</head>
<body>
<!--WRAPPER-->
<div id="wrapper">
<tiles:insertAttribute name="slideIcons"/>
<!--LOGIN FORM-->
<form:form modelAttribute="userForm" class="login-form" method="post">
<tiles:insertAttribute name="inputForm"/>
<tiles:insertAttribute name="authFooterForm"/>
</form:form>
<!--END LOGIN FORM-->
</div>
<!--END WRAPPER-->
<tiles:insertAttribute name="footer"/>
</body>
</html>
打开页面时出现异常
org.apache.tiles.template.NoSuchAttributeException:属性 找不到“ slideIcons”。
请告诉我,可能是什么原因?