New CSS Features don't work well with Tiles

As many other web developers out there probably do something like this, I thought I'd point out that the new CSS feature don't play well with the common use of tiles.

A common approach is to define your boilerplate markup and layout in one jsp:

Title

Your other pages refer to this layout and simply define the named fragments that get inserted into it:

]]>

My point is that, using such a system, its unlikely that your css styles will be declared in the jsp as the stylesheet reference. This is common in Struts, and I believe that WebWork has a similar type of templating system.

Not sure what to suggest - any chance you can just assume that all of the CSS files in the project are potential sources of styles if no explicit stylesheet reference exists in the fragment being edited?

--Richie.

3 comments
Comment actions Permalink

Or am I not getting suggested rename sites because the struts taglibs use styleId and styleClass attributes as wrappers onto id and class?

Still, the CSS validation is very useful.

0
Comment actions Permalink

I think they would need to load all jsp references in jsps, and then look to
see if there is a css and use the list of what ever css files are being
referenced by the referencing jsps. They already do that for page includes,
but this is a Struts specific tag, so not sure how they would support every
tag on the planet which imports or includes another jsp which contains the
reference to the css file, or any other file.

R


On 12/8/04 3:29 PM, in article
2217044.1102537786314.JavaMail.itn@is.intellij.net, "Richard McMahon"
<richie.mcmahon@gmail.com> wrote:

As many other web developers out there probably do something like this, I
thought I'd point out that the new CSS feature don't play well with the common
use of tiles.

A common approach is to define your boilerplate markup and layout in one jsp:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<html:html>
<head>
<title>Title</title>
<html:base/>
<link rel="stylesheet" type="text/css" href="<html:rewrite
page="/css/db.css"/>" />
<script language="JavaScript" type="text/javascript" src="<html:rewrite
page="/js/db.js"/>"></script>
</head>
<body onload="initializeMenus(); setInitialFocus();">
<div id="header">
<html:link page="/" styleId="logo" title="Home page"/>
<h1><tiles:getAsString name="heading" ignore="true"/></h1>
</div>
<tiles:insert page="/tiles/breadcrumbs.jsp"/>
<table id="content">
<tr>
<td id="menubar"><tiles:insert page="/tiles/menu.jsp"/></td>
<td id="body"><html:errors/><tiles:insert attribute="body"/></td>
</tr>
</table>
<tiles:insert page="/tiles/footer.jsp"/>
</body>
</html:html>

Your other pages refer to this layout and simply define the named fragments
that get inserted into it:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert page="/tiles/simpleLayout.jsp" flush="true">
<tiles:put name="heading" value="Content Check Results"/>
<tiles:put name="body" type="string">
<p><html:link forward="testingArea"><html:img page="/images/back.gif"
border="0" align="absmiddle"/> Back</html:link></p>
<div >
<tiles:insert page="/tiles/checkresults.jsp" flush="false"/>
</div>
</tiles:put>
</tiles:insert>

My point is that, using such a system, its unlikely that your css styles will
be declared in the jsp as the stylesheet reference. This is common in Struts,
and I believe that WebWork has a similar type of templating system.

Not sure what to suggest - any chance you can just assume that all of the CSS
files in the project are potential sources of styles if no explicit stylesheet
reference exists in the fragment being edited?

--Richie.


0
Comment actions Permalink

Hi,

Thank you for the detailed example.

CSS support currently knows that style IDs are in 'class' attributes of
the html tags and style linking is achieved via link tag.
We plan to address the issue of different representations for the
latter, as well as other semantic references between different documents
(e.g. xml file and java code, etc) Currently, in Irida plan this
presents as e.g. http://www.intellij.net/tracker/idea/viewSCR?publicId=36974

Please, post your example and vote there.
I would expected that this support could be a plugin.

Richard McMahon wrote:

As many other web developers out there probably do something like this, I thought I'd point out that the new CSS feature don't play well with the common use of tiles.

A common approach is to define your boilerplate markup and layout in one jsp:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<html:html>
<head>
<title>Title</title>
<html:base/>
<link rel="stylesheet" type="text/css" href="<html:rewrite page="/css/db.css"/>" />
<script language="JavaScript" type="text/javascript" src="<html:rewrite page="/js/db.js"/>"></script>
</head>
<body onload="initializeMenus(); setInitialFocus();">
<div id="header">
<html:link page="/" styleId="logo" title="Home page"/>
<h1><tiles:getAsString name="heading" ignore="true"/></h1>
</div>
<tiles:insert page="/tiles/breadcrumbs.jsp"/>
<table id="content">
<tr>
<td id="menubar"><tiles:insert page="/tiles/menu.jsp"/></td>
<td id="body"><html:errors/><tiles:insert attribute="body"/></td>
</tr>
</table>
<tiles:insert page="/tiles/footer.jsp"/>
</body>
</html:html>

Your other pages refer to this layout and simply define the named fragments that get inserted into it:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert page="/tiles/simpleLayout.jsp" flush="true">
<tiles:put name="heading" value="Content Check Results"/>
<tiles:put name="body" type="string">
<p><html:link forward="testingArea"><html:img page="/images/back.gif" border="0" align="absmiddle"/> Back</html:link></p>
<div >
<tiles:insert page="/tiles/checkresults.jsp" flush="false"/>
</div>
</tiles:put>
</tiles:insert>

My point is that, using such a system, its unlikely that your css styles will be declared in the jsp as the stylesheet reference. This is common in Struts, and I believe that WebWork has a similar type of templating system.

Not sure what to suggest - any chance you can just assume that all of the CSS files in the project are potential sources of styles if no explicit stylesheet reference exists in the fragment being edited?

--Richie.

0

Please sign in to leave a comment.