I am working at a tiles application. When i use the tiles tag insert it is not recognized for . I get a warning like this: Unknown tag (tiles:insert)
My jsp page looks like this:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO 8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<table border="1" cellpadding="2" cellspacing="2" align="center">
<tr>
<td>
<tiles:insert attribute="body" />
</td>
</tr>
</table>
</body>
</html>
I am using Struts2 also but those tags are recognized. my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" 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">
<display-name>Struts2 Application</display-name>
<listener>
<listener-class>
org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
</listener>
<context-param>
<param-name>tilesDefinitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern></url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>baseLayout.jsp</welcome-file>
</welcome-file-list>
<jsp-con开发者_运维问答fig>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>http://struts.apache.org/tags-tiles</taglib-location>
</taglib>
</jsp-config>
</web-app>
my jars:
commons-beanutils-1.8.0.jar
commons-digester-1.8.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-logging-1.1.jar
freemarker-2.3.13.jar
junit-3.8.1.jar
ognl-2.6.11.jar
struts2-convention-plugin-2.1.6.jar
struts2-core-2.1.6.jar
struts2-tiles-plugin-2.1.6.jar
tiles-api-2.1.2.jar
tiles-compat-2.1.2.jar
tiles-core-2.1.2.jar
tiles-jsp-2.1.2.jar
tiles-servlet-2.1.2.jar
xwork-2.1.2.jar
Am i missing something?
It was a version problem.
Correct was to use: <tiles:insertAttribute name="body" />
not: <tiles:insert attribute="body" />
精彩评论