You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sriram Nookala <sr...@mediaone.net> on 2002/02/04 18:50:20 UTC

Tiles Vs Templates

I'm trying to get some information in order to make a choice between struts
templates and Tiles for our UI design and templating. Where would you choose
one over the other, and what does Tiles offer you that Templates doesn't?
thanks,
sriram


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tiles Vs Templates

Posted by Jon Ferguson <fe...@ieee.org>.
I'm going with Tiles.. they are totally compatible and make better use of XML to
layout tiles.. That reduced my object count significantly.

Cheers,
Jon

Sriram Nookala wrote:

> I'm trying to get some information in order to make a choice between struts
> templates and Tiles for our UI design and templating. Where would you choose
> one over the other, and what does Tiles offer you that Templates doesn't?
> thanks,
> sriram
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tiles Vs Templates

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  If you  use only features from Template, then use only Templates.
  If you use some Tiles advanced features, then use Tiles.

  Generally, if you have a very large project with many pages, use Tiles.

  Tiles allow to build pages by assembling small pieces (Tiles). Usually, you use
a layout (or template) to build pages. With Tiles, and its definition concept,
you can build all your pages in a centralized xml pages. Furthermore, you avoid
repeated work by using an inheritance mechanism. Also, you can use a definition
name as the target of a Struts forward. The definition file can be split in
several sub-file....
  There are others interesting features in Tiles that you will discover if you
play a bit with Tiles.

   Cedric


Sriram Nookala wrote:

> I'm trying to get some information in order to make a choice between struts
> templates and Tiles for our UI design and templating. Where would you choose
> one over the other, and what does Tiles offer you that Templates doesn't?
> thanks,
> sriram
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tiles Vs Templates

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  This prove that there is a need in such kind of frameworks ;-)

  At first glance, it looks like similar to Tiles. I will investigate more on it asap.

  Also, Tiles is open, and anyone can participate to improve it,  bring new ideas, and
why not starting its successor ;-)

     Cedric

nicolas bonvin wrote:

> Hi everyone,
>
> I do not want to start a flame war out here but after trying Templates and
> Tiles, I recently successfuly used a custom Web Toolkit (wtk) on a couple of
> J2ee projects. It is available at http://ultrawork.sourceforge.net.
>
> The org.ultrawork.wtk.mc package provides a few classes and taglibs that let
> you use strongly typed components inside Jsps or Servlets. The following
> components are available :
>         Page, represents an Html markup document.
>         Container, can hold components and arrange how it display them using a
> layout.
>         Text, represents internationalizable text.
>         Block, represents a fragment of markup.
>         Link, represents an html link to either a resource that is located inside
> the web application, or to an external resource.
>
> My 2ç on the 3 alternatives :
>
> Templates, pros:
>         very simple
> Templates, cons:
>         lacks important features such as central-definition of components
>         no inheritance between components
>
> Tiles, pros:
>         very powerful
>         compatible with Templates
>         provides central-definition of components
>         inheritance
> Tiles, cons:
>         has a bigger API (more than 40 classes)
>         lacks real component types such as texts, links, or markup fragments
>         I found it more complicated to extend, especially when writing portal-type
> user-customizable pages.
>         you have to specify a name to any component you create, even if the
> component only exists within another one.
>
> org.ultrawork.wtk.mc, pros:
>         simple (18 classes) and easy to extend
>         offers different types of components including containers and i18n support
>         Jsp and Servlet layouts implementation
>         simple syntax with the lowest possible overhead when defining complex
> components
>         access to the components graph of a container through a dotted syntax
> org.ultrawork.wtk.mc, cons:
>         yet another new component toolkit (mc stands for More Components)
>
> hope this helps,
>
> nicolas
>
> > -----Original Message-----
> > From: Sriram Nookala [mailto:srinookala@mediaone.net]
> > Sent: Monday, February 04, 2002 6:50 PM
> > To: Struts Users Mailing List
> > Subject: Tiles Vs Templates
> >
> >
> > I'm trying to get some information in order to make a choice
> > between struts
> > templates and Tiles for our UI design and templating. Where would
> > you choose
> > one over the other, and what does Tiles offer you that Templates doesn't?
> > thanks,
> > sriram
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: error implementing menus using tiles

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  Hello,

  Checking quickly your code, I can't find any problems.
  Can you confirm that you have successfully installed and use Tiles
documentation ? Also, what url do you use to access the topnavbar.jsp, or its
parents ?

  Cedric

Sriram Nookala wrote:

> I'm trying to create a dynamic menu using the tiles tutorial, but I get the
> following error when I display the jsp:
>
> [ServletException in:/topnavbar.jsp] Cannot find bean links in scope page'
>
> What am I doing wrong?
>
> thanks,
> sriram
>
> My implementation is as follows:
>
> 1. I have a topnvabar.jsp which is similar to the tiles example submenu.jsp:
>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
>
> <%@ page import="java.util.Iterator" %>
>
> <%-- Push component attributes in page context --%>
>
> <comp:importAttribute />
>
> <table>
>
> <logic:present name="title">
>
> <tr>
>
> <th colspan=2>
>
> <div align="left"><strong><bean:write name="title"/></strong></div>
>
> </th>
>
> </tr>
>
> </logic:present>
>
> <%-- Check if selected exist. --%>
>
> <logic:notPresent name="selected" >
>
> <% pageContext.setAttribute( "selected", "" ); %>
>
> </logic:notPresent>
>
> <%-- Prepare the links list to be iterated --%>
>
> <bean:define id="links" name="links" type="java.util.List" scope="page" />
>
> <% Iterator i = links.iterator(); %>
>
> <%-- iterate on items list --%>
>
> <%-- Normally, we should write something like this :
>
> <logic:iterate id="item" name="items" type="java.lang.String" >
>
> But, Struts doesn't declare the TEI class for iterate, and
>
> some web container deal badly with the declared variable.
>
> So, we use what follow instead.
>
> --%>
>
> <logic:iterate id="iterateItem" name="items" >
>
> <bean:define id="item" name="iterateItem" type="java.lang.String"
> scope="page" />
>
> <tr>
>
> <td width="10" valign="top" ></td>
>
> <td valign="top" >
>
> <%-- check if selected --%>
>
> <logic:notEqual name="selected" value="<%=item%>">
>
> <% // Compute link value
>
> String link = (String)i.next();
>
> if(link.startsWith("/") )
>
> link = request.getContextPath() + link;
>
> %>
>
> <font size="-1"><a href="<%=link%>"><%=item%></a></font>
>
> </logic:notEqual>
>
> <logic:equal name="selected" value="<%=item%>">
>
> <font size="-1" color="fuchsia"><%=item%></font>
>
> </logic:equal>
>
> </td>
>
> </tr>
>
> </logic:iterate>
>
> </table>
>
> 2. I have a tilesDefinitons.xml with the following relevant entries:
>
> <tiles-definitions>
>     <definition name="baseDef" path="/TopLevelTemplate.jsp">
>       <put name="title" value="" />
>       <put name="topnavbar" value="topnavbar.links" />
>       <put name="sectionnavbar" value="/sectionnavbar.jsp" />
>       <put name="leftnavbar" value="/leftnavbar.jsp" />
>       <put name="content" value="" />
>       <put name="footer" value="/footer.jsp" />
>     </definition>
>
>     <definition name="topnavbar.links" path="/topnavbar.jsp" >
>       <put name="selected" value="Home" />
>       <putList name="items" >
>         <add value="Home" />
>         <add value="Campaign" />
>         <add value="Segment" />
>         <add value="Analyze" />
>         <add value="Profile" />
>         <add value="Admin" />
>       </putList>
>       <putList name="links" >
>         <add value="home.action" />
>         <add value="campaignlist.action?name=home" />
>         <add value="home.action" />
>         <add value="home.action" />
>         <add value="home.action" />
>         <add value="home.action" />
>       </putList>
>     </definition>
>
>     <definition name="home" extends="baseDef">
>       <put name="title" value="Campaign Manager Home" />
>       <put name="content" value="/HomeContent.jsp" />
>     </definition>
>
> </tiles-definitions>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


error implementing menus using tiles

Posted by Sriram Nookala <sr...@mediaone.net>.
I'm trying to create a dynamic menu using the tiles tutorial, but I get the
following error when I display the jsp:

[ServletException in:/topnavbar.jsp] Cannot find bean links in scope page'

What am I doing wrong?

thanks,
sriram

My implementation is as follows:

1. I have a topnvabar.jsp which is similar to the tiles example submenu.jsp:

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

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

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

<%@ page import="java.util.Iterator" %>



<%-- Push component attributes in page context --%>

<comp:importAttribute />

<table>

<logic:present name="title">

<tr>

<th colspan=2>

<div align="left"><strong><bean:write name="title"/></strong></div>

</th>

</tr>

</logic:present>

<%-- Check if selected exist. --%>

<logic:notPresent name="selected" >

<% pageContext.setAttribute( "selected", "" ); %>

</logic:notPresent>

<%-- Prepare the links list to be iterated --%>

<bean:define id="links" name="links" type="java.util.List" scope="page" />

<% Iterator i = links.iterator(); %>

<%-- iterate on items list --%>

<%-- Normally, we should write something like this :

<logic:iterate id="item" name="items" type="java.lang.String" >

But, Struts doesn't declare the TEI class for iterate, and

some web container deal badly with the declared variable.

So, we use what follow instead.

--%>

<logic:iterate id="iterateItem" name="items" >

<bean:define id="item" name="iterateItem" type="java.lang.String"
scope="page" />



<tr>

<td width="10" valign="top" ></td>

<td valign="top" >

<%-- check if selected --%>

<logic:notEqual name="selected" value="<%=item%>">

<% // Compute link value

String link = (String)i.next();

if(link.startsWith("/") )

link = request.getContextPath() + link;

%>

<font size="-1"><a href="<%=link%>"><%=item%></a></font>

</logic:notEqual>

<logic:equal name="selected" value="<%=item%>">

<font size="-1" color="fuchsia"><%=item%></font>

</logic:equal>

</td>

</tr>

</logic:iterate>

</table>



2. I have a tilesDefinitons.xml with the following relevant entries:



<tiles-definitions>
    <definition name="baseDef" path="/TopLevelTemplate.jsp">
      <put name="title" value="" />
      <put name="topnavbar" value="topnavbar.links" />
      <put name="sectionnavbar" value="/sectionnavbar.jsp" />
      <put name="leftnavbar" value="/leftnavbar.jsp" />
      <put name="content" value="" />
      <put name="footer" value="/footer.jsp" />
    </definition>

    <definition name="topnavbar.links" path="/topnavbar.jsp" >
      <put name="selected" value="Home" />
      <putList name="items" >
        <add value="Home" />
        <add value="Campaign" />
        <add value="Segment" />
        <add value="Analyze" />
        <add value="Profile" />
        <add value="Admin" />
      </putList>
      <putList name="links" >
        <add value="home.action" />
        <add value="campaignlist.action?name=home" />
        <add value="home.action" />
        <add value="home.action" />
        <add value="home.action" />
        <add value="home.action" />
      </putList>
    </definition>

    <definition name="home" extends="baseDef">
      <put name="title" value="Campaign Manager Home" />
      <put name="content" value="/HomeContent.jsp" />
    </definition>

</tiles-definitions>





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Tiles Vs Templates

Posted by nicolas bonvin <ar...@individa.com>.
Hi everyone,

I do not want to start a flame war out here but after trying Templates and
Tiles, I recently successfuly used a custom Web Toolkit (wtk) on a couple of
J2ee projects. It is available at http://ultrawork.sourceforge.net.

The org.ultrawork.wtk.mc package provides a few classes and taglibs that let
you use strongly typed components inside Jsps or Servlets. The following
components are available :
	Page, represents an Html markup document.
	Container, can hold components and arrange how it display them using a
layout.
	Text, represents internationalizable text.
	Block, represents a fragment of markup.
	Link, represents an html link to either a resource that is located inside
the web application, or to an external resource.

My 2ç on the 3 alternatives :

Templates, pros:
	very simple
Templates, cons:
	lacks important features such as central-definition of components
	no inheritance between components

Tiles, pros:
	very powerful
	compatible with Templates
	provides central-definition of components
	inheritance
Tiles, cons:
	has a bigger API (more than 40 classes)
	lacks real component types such as texts, links, or markup fragments
	I found it more complicated to extend, especially when writing portal-type
user-customizable pages.
	you have to specify a name to any component you create, even if the
component only exists within another one.

org.ultrawork.wtk.mc, pros:
	simple (18 classes) and easy to extend
	offers different types of components including containers and i18n support
	Jsp and Servlet layouts implementation
	simple syntax with the lowest possible overhead when defining complex
components
	access to the components graph of a container through a dotted syntax
org.ultrawork.wtk.mc, cons:
	yet another new component toolkit (mc stands for More Components)


hope this helps,

nicolas


> -----Original Message-----
> From: Sriram Nookala [mailto:srinookala@mediaone.net]
> Sent: Monday, February 04, 2002 6:50 PM
> To: Struts Users Mailing List
> Subject: Tiles Vs Templates
>
>
> I'm trying to get some information in order to make a choice
> between struts
> templates and Tiles for our UI design and templating. Where would
> you choose
> one over the other, and what does Tiles offer you that Templates doesn't?
> thanks,
> sriram
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>