I'm developing my own project using spring-mvc and spring-webflow. After reading some articles about spring webflow and ajax, I understood the better option is the use of Apache Tiles for rendering the view.
In Sitemesh i used a tag call head (). That tag used in the template allows render the entire head attribute of a page rendered on the resulting HTML.
Is there any way to achive this in Apache Tiles? From my readings i presume that i have to do the following:
Two jps, one with the body of the page and another with the head definition. Here is an example with the template, a page and the tiles definition for better understanding.
the tiles definition
<tiles-definitions>
<definition name="base" template="/WEB-INF/view/templates/tileslayout.jsp">
<put-attribute name="title" value="Held - main page"/>
<put-attribute name="body" value=""/>
<put-attribute name="head" value=""/>
</definition>
<definition name="company.edit" extends="base">
<put-attribute name="head" value="/WEB-INF/view/company/editHeader.jsp"></put-attribute>
<put-attribute name="body" value="/WEB-INF/view/company/edit.jsp"></put-attribute>
</definition>
</tiles-definitions>
the template:
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<html>
<head>
-- css and scripts --
<tiles:insertAttribute name="head" ignore="true"/>
<!-- <decorator:head /> -->
</head>
<body>
--- menu definition ---
<div class="container-fluid">
<tiles:insertAttribute name="body"/>
<!-- <decorator:body/> -->
</div>
<hr/>
<footer>
-----
</footer>
</body>
</html>
a company page
<div class="container">
-- the page html code
</div>
the head company page
<meta name="menu" content="company" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
.error {
color: red;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$('#name').focus();
});
</script>
sometimes the head maybe more complex.
The resulting html is ok. But i don't like to define two jps for something that should be simple.
I'm doing something wrong?
Is there a better way to do this?