template.jsp in Suns Petstore??
Hello Amigos!I'm looking at suns Petstore (for J2EE). They are in some how using a template.jsp thats looks like this:
<%@ taglib uri="/WEB-INF/template.tld" prefix="template" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title><template:insert parameter="title" /></title>
</head>
<body bgcolor="#FFFFFF">
<table width="100%" height="100%" border="0" cellpadding="5" cellspacing="0">
<tr height="100" valign="top">
<td colspan="3"><template:insert parameter="banner" /></td>
</tr>
<tr valign="top">
<td width="20%" valign="top">Balle</td>
<td width="60%" valign="top"><template:insert parameter="body" /></td>
<td valign="top">
Balle
</td>
</tr>
<tr valign="bottom">
<td colspan="3"><template:insert parameter="advicebanner" /></td>
</tr>
<tr>
<td colspan="3"><template:insert parameter="footer" /></td>
</tr>
</table>
</body>
</html>
I guess that they insert some code at the tags :<template:insert parameter="xxx" />
And I also guess that they fetch the values to insert from a file called screendefinitions.xml. That file got tags that look like this:
<template>/template.jsp</template>
<screen>
<screen-name>MAIN</screen-name>
<parameter key="HtmlTitle" value="Welcome to Java Pet Store Demo" direct="true"/>
<parameter key="HtmlBanner" value="/banner.jsp" direct="false"/>
<parameter key="HtmlBody" value="/index.jsp" direct="false"/>
<parameter key="HtmlPetFooter" value="/petfooter.jsp" direct="false"/>
<parameter key="HtmlFooter" value="/footer.jsp" direct="false"/>
<parameter key="Annotation" value="/estore/annotation/ann_overview_j2ee.jsp" direct="true"/>
</screen>
...or...
<default-template>/template.jsp</default-template>
<screen name="main">
<parameter key="title" value="Welcome to the BluePrints Petstore" direct="true"/>
<parameter key="banner" value="/banner.jsp" />
<parameter key="sidebar" value="/sidebar.jsp" />
<parameter key="body" value="/main.jsp" />
<parameter key="mylist" value="/mylist.jsp" />
<parameter key="advicebanner" value="/advice_banner.jsp" />
<parameter key="footer" value="/footer.jsp" />
</screen>
But I can't figure out how or where they merge this together and how they sends the result back to the browser.
So if any one know the Petstore well, please let me know how it works with the template.jsp.
They also got a file called mappings.xml where they in some how mapps the incomming url to the outgoing. It has tags looking like this:
<url-mapping url="order.do" screen="order_complete.screen" >
<web-action-class>com.sun.j2ee.blueprints.petstore.controller.web.actions.OrderHTMLAction</web-action-class>
</url-mapping>
But I can't figure out how this works together when I look at the code in the java-files.
So please help.
Best regards
Fredrik
