当我使用Tomcat 8时,我收到以下错误:
Caused by: java.io.IOException: ServletException including path '/WEB-INF/jsp/tiles-base.jsp'.
at org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)
at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:245)
at org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:54)
at org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
... 37 more
Caused by: java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.jsp.tiles_002dbase_jsp
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:131)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:62)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:129)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:368)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:523)
at org.apache.tiles.request.servlet.ServletRequest.doInclude(ServletRequest.java:243)
... 41 more
Run Code Online (Sandbox Code Playgroud)
希望摆脱这个错误,我从Tiles 2.2.2升级到Tiles 3.0.5.但是仍然会遇到与Tomcat 8相同的错误.
使用Tomcat 7它可以工作.
我使用Spring版本3.2.9.RELEASE.
我认为它必须是Servlet API的一部分......?知道该怎么办?
这是tiles-base.jsp:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<% …Run Code Online (Sandbox Code Playgroud) 我正在尝试将Spring安全性与自定义登录页面和对数据库的访问权限添加到我的Spring MVC应用程序中.看起来我的映射是错误的,因为它无法映射j_spring_security_check.
为了解决这个问题,我看了一下以下页面1,2,3,但没能解决这个问题呢.
如果您没有太多时间,请阅读下面的第2部分,即问题的编辑部分开始的地方.否则,请阅读第1 部分和第2部分.
第1部分
我还在我的web.xml文件中添加了以下行,但应用程序返回以下异常.
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Caused by: java.lang.IllegalStateException: Duplicate Filter registration for 'springSecurityFilterChain'. Check to ensure the Filter is only configured once.
at org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer.registerFilter(AbstractSecurityWebApplicationInitializer.java:215)
at org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer.insertSpringSecurityFilterChain(AbstractSecurityWebApplicationInitializer.java:147)
at org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer.onStartup(AbstractSecurityWebApplicationInitializer.java:121)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Jun 13, 2015 2:44:54 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during …Run Code Online (Sandbox Code Playgroud) 我们如何将Struts 2与Tiles 3集成?struts2-tiles-plugin目前(2.3.4.1)适用于旧版本的磁贴(版本2.0.6),这可能有点令人讨厌.
这是一个自我回答,帮助他人整合.
我有一个使用Tile3的Spring MVC应用程序.我有很多静态页面需要将它们嵌入到tile3当前提供的网站模板中.(我需要在所有页面上使用相同的页脚和页眉,无论是动态还是静态,但不确定如何对静态页面进行寻址).
静态页面的示例是index.jsp和aboutus.jsp.如何访问这些静态页面?我应该通过控制器吗?
我知道我可以使用jsp:include但这是一个好习惯吗?因为我正在使用瓷砖,所以没有其他选择吗?本教程建议使用单独的控制器,但我不确定这是否是最佳解决方案.因为它向服务器发送不必要的请求.
如果有比Tiles更好的选择,请告诉我
web.xml中
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<listener>
<listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springapp-servlet.xml</param-value>
</context-param>
</web-app>
Run Code Online (Sandbox Code Playgroud)
tiles.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
<definition name="baseLayout" template="/WEB-INF/templates/baseLayout.jsp">
<put-attribute name="title" value="Title is here (Tile)"/>
<put-attribute name="header" value="header.jsp"/>
<put-attribute name="menu" value="Title is here (Tile)"/>
<put-attribute name="body" value="Title is here (Tile)"/>
<put-attribute name="footer" value="footer.jsp"/>
</definition> …Run Code Online (Sandbox Code Playgroud) 我正在接受Apche tiles 3和Spring MVC 4的警告我没有为多语言支持添加任何额外的配置,但它默认支持.任何人都可以帮我禁用此选项以在我的网站中删除此警告.
org.apache.tiles.request.locale.PostfixedApplicationResource.
<init> No supported matching language for locale "sw".
Using file:/opt/apache-tomcat-8.0.35/webapps/ROOT/WEB-INF/tiles/app-core_sw.xml as a non-localized resource path. see TILES-571
Run Code Online (Sandbox Code Playgroud) 我正在使用Spring框架版本4,我混淆了哪个文件夹放置XML文件,特别是tile定义以及在哪里找到解析器bean.
在尝试将列表属性添加到定义之前,我对tile 3.0.1没有任何问题.没有错误,定义也正确呈现,除了列表属性似乎不存在于JSP上.
我正在使用CompleteAutoloadListener加载切片,这里是web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
<listener-class>org.apache.tiles.extras.complete.CompleteAutoloadTilesListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>/index.action</welcome-file>
</welcome-file-list>
</web-app>
Run Code Online (Sandbox Code Playgroud)
以下是定义的外观(tiles-defs.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>
<definition name="head-default" template="/WEB-INF/template/head.jsp">
<put-list-attribute name="items">
<add-attribute value="/style/cssbase-min.css" />
<add-attribute value="/style/cssfonts-min.css" />
<add-attribute value="/style/cssreset-min.css" />
<add-attribute value="/style/grids-min.css" />
<add-attribute value="/style/style.css" />
</put-list-attribute>
</definition>
<definition name="default" template="/WEB-INF/template/template.jsp">
<put-list-attribute name="items" inherit="true"/>
<put-attribute name="head" value="head-default"/> …Run Code Online (Sandbox Code Playgroud) tiles-3 ×7
apache-tiles ×4
java ×4
spring ×4
spring-mvc ×3
struts2 ×2
jsp ×1
spring-4 ×1
struts-tags ×1
tiles ×1
tomcat ×1