I m using a css file with tiles but it is not working.
my tiles.xml is:
<tiles-definitions> <definition name="baseLayout" template="/jsps/mail/mailbase.jsp"> <put-attribute name="css" value="/css/mail.css" type="string" /> <put-attribute name="menu" value="/jsps/mail/menu.jsp"/> <put-attribute name="body" value=""/> </definition> <definition name="inbox.tile" extends="baseLayout"> <put-attribute name="css" value="/css/mail.css" type="string" /> <put-attribute name="body" value="/jsps/mail/inbox.jsp"/> </definition> <definition name="msgdetail.tile" extends="baseLayout"> <put-attribute name="body" value="/jsps/mail/msgDetails.jsp"/> </definition> <definition name="compose.tile" extends="baseLayout"> <put-attribute name="body" value="/jsps/mail/compose.jsp"/> </definition> <definition name="msgsent.tile" extends="baseLayout"> <put-attribute name="body" value="/jsps/mail/msg_sent.html"/> </definition> </tiles-definitions>
and my jsp is:
<%@ page contentType="text/html;charset=UTF-8"%> <%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%> <%@ taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link type="text/css" rel="stylesheet" href="<tiles:getAsString name='css'/>"/> </head> <body> <div id="left"><tiles:insertAttribute name="menu"/></div> <div id="right"><tiles:insertAttribute name="body"/></div> </body> </html>
My CSS file "mail.css" lies in tomcat_root/web-app-name/css/mail.css
and jsp is in tomcat_root/web-app-name/jsps/mailbase.jsp
control flow is like:
request---------->inboxaction(struts2.xml)------------------>inbox.tile (tiles.xml)
HTML output is not showing any of the formatting described in css(it is not reading css file at all.)
can anyone please tell me that what is wrong in my code.
thanks