I have deleloped a simple spring 3 application following a tutorial. After that, I did integrated tiles 2. Right now I am trying to use css style in my tiles but i can not do this and i can not even display an image.
Inside my tiles.xml I have:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="base.definition"
template="/WEB-INF/jsp/layout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/WEB-INF/jsp/header.jsp" />
<put-attribute name="menu" value="/WEB-INF/jsp/menu.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="styles" value="base.css"/>
<put-attribute name="footer" value="/WEB-INF/jsp/footer.jsp" />
</definition>
<definition name="dogBreed" extends="base.definition">
<put-attribute name="title" value="Contact Manager" />
<put-attribute name="body" value="/WEB-INF/jsp/dogBreed.jsp" />
</definition>
</tiles-definitions>
Inside layout.jsp I have
<%@ taglib uri="http://tiles.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>
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/styles/style.css"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><tiles:insertAttribute name="title" ignore="true" /></title>
</head>
<body>
<table border="1" cellspacing="0" cellpadding="0" style="width:100%;height:100%">
<tr>
<td height=10% width=100%><tiles:insertAttribute name="header" />
</td>
</tr>
<tr>
<td height=80% width=20%><tiles:insertAttribute name="menu" /></td>
<td width=80% height=80%><tiles:insertAttribute name="body" /></td>
</tr>
<tr>
<td height=10% width=100%><tiles:insertAttribute name="footer" />
</td>
</tr>
</table>
</body>
</html>
What I want is to remove the table structure and use css. For this I use on layout.jsp the following:
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/style style.css"/>
Now inside my header.jsp I have:
<div id="header">
<div class="top_right">
<div class="languages">
<div class="lang_text">Languages:</div>
<a href="#" class="lang"><img src="<%=request.getContextPath()%>/styles/images/en.gif" alt="" title="" border="0" /></a>
<a href="#" class="lang"><img src="styles/images/de.gif" alt="" title="" border="0" /></a>
</div>
<div class="big_banner">
<a href="#"><img src="images/banner728.jpg" alt="" title="" border="0" /></a>
</div>
</div>
<div id="logo">
<a href="index.html"><img src="images/logo.png" alt="" title="" border="0" width="182" height="85" /></a>
</div>
</div>
None of the imaeges are getting displayed here and i do not understand why.
The folder styles which cotnrains css and images is in the rood folder of the war.
Also I get an error in my console saying that "no mapping found for HTTP request with uri /pedsample/styles/images/en.gif in dispatcher servlet with name spring"
My web.xml contains the following if od any help:
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Any help would be appreciated.
Thanks a lot, giannis