You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin DeMello <ma...@yahoo.com> on 2003/12/10 08:59:58 UTC

tapestry and templating systems

Has anyone tried mixing tapestry with a templating system like velocity?
There's a lot of annoying html code that would be better expressed using
velocimacros (far lighter than defining tapestry components), but tapestry
would need to invoke it before it processed the template, and I'm not sure how
feasible that is.

martin

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and templating systems

Posted by Amol Yadwadkar <ay...@webifyservices.com>.
Hi Martin,
We shifted from Velocity Macors to Tapestry and really was encouraging !!!!
Can u please be clear abt what you want to acheive thrgh. Tapestry.
I am not exactlly understanding what do u want to acheive in Tapestry .(
>From ur Point of View:-->> which looks easy in VMs.)
I may help u in the case u provide me with details.
best regds,
Amol
----- Original Message -----
From: "Martin DeMello" <ma...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, December 10, 2003 1:29 PM
Subject: tapestry and templating systems


> Has anyone tried mixing tapestry with a templating system like velocity?
> There's a lot of annoying html code that would be better expressed using
> velocimacros (far lighter than defining tapestry components), but tapestry
> would need to invoke it before it processed the template, and I'm not sure
how
> feasible that is.
>
> martin
>
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and templating systems

Posted by Glen Stampoultzis <gs...@iinet.net.au>.
At 06:59 PM 10/12/2003, you wrote:
>Has anyone tried mixing tapestry with a templating system like velocity?
>There's a lot of annoying html code that would be better expressed using
>velocimacros (far lighter than defining tapestry components), but tapestry
>would need to invoke it before it processed the template, and I'm not sure how
>feasible that is.
>
>martin

I'm not sure whether such a thing would be possible but I consider the pure 
HTML approach of Tapestry to be one of its big advantages.  Finally I can 
use HTML tools like dreamweaver without things going crazy.  It also seems 
to encourage a cleaner separation of the view and the model.

Just my 2 cents (AU).

Regards,

Glen

Re: tapestry and templating systems

Posted by Martin DeMello <ma...@yahoo.com>.
--- Erik Hatcher <er...@ehatchersolutions.com> wrote:
> On Wednesday, December 10, 2003, at 05:08  AM, Martin DeMello wrote:
> > Yes, that sounds like it would work nicely. The page code is static, I 
> > just
> > wanted to write it at a higher level than HTML (the approach I've 
> > taken in the
> > past, for small, personal websites, is to write the page out using some
> > minimalist custom markup, then write ruby code to convert that to 
> > html. It
> > doesn't scale very well, of course, but I miss being able to *see* the
> > structure of the page in the ASCII representation.
> 
> So instead of Velocity, why not use Ruby for this like your other 
> projects?  Just use <exec> in Ant to invoke Ruby to generate templates 
> during the build process.

The project decision was to keep it java-based as far as possible, lest I have
to hand it over to someone else at some point. I do have a few code-generation
ruby scripts lying around, but they aren't part of the build process. Velocity
feels pretty nice, so I don't really mind using it, and it does have the
advantage of being the "minimal working solution", being purely designed for
templating.

I might still go over to ruby if I need that sort of power, but I don't think 
will in this case.

martin

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and templating systems

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Wednesday, December 10, 2003, at 05:08  AM, Martin DeMello wrote:
> Yes, that sounds like it would work nicely. The page code is static, I 
> just
> wanted to write it at a higher level than HTML (the approach I've 
> taken in the
> past, for small, personal websites, is to write the page out using some
> minimalist custom markup, then write ruby code to convert that to 
> html. It
> doesn't scale very well, of course, but I miss being able to *see* the
> structure of the page in the ASCII representation.

So instead of Velocity, why not use Ruby for this like your other 
projects?  Just use <exec> in Ant to invoke Ruby to generate templates 
during the build process.


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and templating systems

Posted by Martin DeMello <ma...@yahoo.com>.
--- Erik Hatcher <er...@ehatchersolutions.com> wrote:
> On Wednesday, December 10, 2003, at 05:08  AM, Martin DeMello wrote:
> > Intriguing, but way beyond me, I'm afraid :) The other thing I thought 
> > of was
> > to have ant run velocity over my pseudotemplate, so that by the time 
> > tapestry
> > was invoked all it would see would be the real template. That way, I 
> > also take
> > the velocity hit at compile time rather than runtime, which since the
> > pseudotemplates are static should speed things up a bit.
> 
> If you don't need runtime generation, then the Ant idea is just right.  
> For that, I recommend using VPP <http://vpp.sourceforge.net>

Thanks!! That solves the problem very nicely indeed.

martin

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and templating systems

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Wednesday, December 10, 2003, at 05:08  AM, Martin DeMello wrote:
> Intriguing, but way beyond me, I'm afraid :) The other thing I thought 
> of was
> to have ant run velocity over my pseudotemplate, so that by the time 
> tapestry
> was invoked all it would see would be the real template. That way, I 
> also take
> the velocity hit at compile time rather than runtime, which since the
> pseudotemplates are static should speed things up a bit.

If you don't need runtime generation, then the Ant idea is just right.  
For that, I recommend using VPP <http://vpp.sourceforge.net>

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and templating systems

Posted by Martin DeMello <ma...@yahoo.com>.
--- Erik Hatcher <er...@ehatchersolutions.com> wrote:
> On Wednesday, December 10, 2003, at 02:59  AM, Martin DeMello wrote:
> > Has anyone tried mixing tapestry with a templating system like 
> > velocity?
> > There's a lot of annoying html code that would be better expressed 
> > using
> > velocimacros (far lighter than defining tapestry components), but 
> > tapestry
> > would need to invoke it before it processed the template, and I'm not 
> > sure how
> > feasible that is.
> 
> I'll deflect your question somewhat as others have already replied on 
> the anti-Tapestry nature of what you seem to be directly asking.   
> "annoying htmlm code" - haha :)  This is a major driving force behind 
> the existence of Tapestry, in fact.
> 
> We have in our system a need to display blocks of user customizable 
> text.  We wrote a component which pulls these blocks from the database 
> and processes them through Velocity and renders to a Tapestry template. 
>   Would something like this perhaps be more along the lines of what you 
> are after?

Yes, that sounds like it would work nicely. The page code is static, I just
wanted to write it at a higher level than HTML (the approach I've taken in the
past, for small, personal websites, is to write the page out using some
minimalist custom markup, then write ruby code to convert that to html. It
doesn't scale very well, of course, but I miss being able to *see* the
structure of the page in the ASCII representation.

> On a far more complex note, though, where templates come from is 
> extremely configurable.  For example, a template could live in the 
> database or be generated on the fly.  Generated on the fly?  Hmmmm.... 
> so you could hook the template source as coming from some of your 
> custom code that preprocesses a pseudo-template with Velocity turning 
> it into a real Tapestry template.  This would be pretty complex to do 
> and also pretty "out there", but at least Tapestry gives you this type 
> of capability.

Intriguing, but way beyond me, I'm afraid :) The other thing I thought of was
to have ant run velocity over my pseudotemplate, so that by the time tapestry
was invoked all it would see would be the real template. That way, I also take
the velocity hit at compile time rather than runtime, which since the
pseudotemplates are static should speed things up a bit.

martin

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: tapestry and templating systems

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Wednesday, December 10, 2003, at 02:59  AM, Martin DeMello wrote:
> Has anyone tried mixing tapestry with a templating system like 
> velocity?
> There's a lot of annoying html code that would be better expressed 
> using
> velocimacros (far lighter than defining tapestry components), but 
> tapestry
> would need to invoke it before it processed the template, and I'm not 
> sure how
> feasible that is.

I'll deflect your question somewhat as others have already replied on 
the anti-Tapestry nature of what you seem to be directly asking.   
"annoying htmlm code" - haha :)  This is a major driving force behind 
the existence of Tapestry, in fact.

We have in our system a need to display blocks of user customizable 
text.  We wrote a component which pulls these blocks from the database 
and processes them through Velocity and renders to a Tapestry template. 
  Would something like this perhaps be more along the lines of what you 
are after?

On a far more complex note, though, where templates come from is 
extremely configurable.  For example, a template could live in the 
database or be generated on the fly.  Generated on the fly?  Hmmmm.... 
so you could hook the template source as coming from some of your 
custom code that preprocesses a pseudo-template with Velocity turning 
it into a real Tapestry template.  This would be pretty complex to do 
and also pretty "out there", but at least Tapestry gives you this type 
of capability.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: tapestry and templating systems

Posted by Martin DeMello <ma...@yahoo.com>.
--- Dmitriy Kiriy <dk...@oilspace.com> wrote:
> Martin ,what you write is a typical Tapesty thing.
> 
> 	That you need is:
> 	1. Before page render, read information to List and put it to page beans
> 	2. Use ForEach compenent to iterate throw the list.
> 	3. Use simple text component to write out Company name, title, adress 1 and
> so on.
> 
> All of that in examples. Do you have a chance to see on examples?

I've done that for some of the other tables, but in several tables there's a
custom page layout (it's not just a simple vertical list of fields), and I
couldn't figure out how to combine that with a ForEach. I did try a few
experiments with wrapping a textfield in a custom table row, but I still
haven't been able to get direction="form" bindings working :-/ Are there any
simple examples of that? I looked through the example and contrib code but
couldn't find any helpful example.

martin

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: tapestry and templating systems

Posted by Dmitriy Kiriy <dk...@oilspace.com>.
Martin ,what you write is a typical Tapesty thing.

	That you need is:
	1. Before page render, read information to List and put it to page beans
	2. Use ForEach compenent to iterate throw the list.
	3. Use simple text component to write out Company name, title, adress 1 and
so on.

All of that in examples. Do you have a chance to see on examples?

	Dmitriy


>-----Original Message-----
>From: Martin DeMello [mailto:martindemello@yahoo.com]
>Sent: Wednesday, December 10, 2003 12:52 PM
>To: Tapestry users
>Subject: RE: tapestry and templating systems
>
>
>--- Dmitriy Kiriy <dk...@oilspace.com> wrote:
>> What kind of "annoying html code that would be better expressed using
>> velocimacros" do you found?
>>
>> My experience for moving to Tapestry is: if developer think such, he just
>> not understand what IS Tapestry in details.
>> So, pls, provide an snippnet of annoying html code and what you
>want to see
>
>The thing is, I've inherited an ASP application that I need to (i)
>port to java
>(ii) enhance with several new features. The ASP pages were
>evidently written
>using a wysiwyg designer, and have things like tables where there
>are colour
>and font directives in every cell, nested tables and other
>verbose, nitpicky
>details. I'm finding it fairly hard to see what's happening amidst all the
>clutter, and have to keep scrolling back and forth to get context.
>Right now
>I'm trying to retain the look and feel, while cutting down on the code
>verbosity, so the first thing I thought of was some sort of macro system.
>
>Here's the sort of code I'm talking about:
>
>------begin------
>
><tr>
>	<td width="68%" align="left"  valign="top">
>		<table width="100%" cellspacing="0" cellpadding="0"
>			border="1" style="border-collapse: collapse"
>			bordercolor=#808080>
>			<tr>
>				<td width="25%" height="35">
>					<font face='Verdana'
>size='2' color='red'>*</font><font face='Verdana'
>size='2' color='#000000'>
>						<b>Org Title:</b>
>					</font>
>				</td>
>				<td width="75%" height="35"
>colspan="2">&nbsp;
>					<input type="text" name="txtOrgTtl"
>					maxlength="50" value="Company"
>					size="34">
>				</td>
>			</tr>
>			<tr>
>				<td width="25%" height="35">
>					<font face='Verdana'
>size='2' color='red'>*</font><font face='Verdana'
>size='2' color='#000000'>
>						<b>Address 1:</b>
>					</font>
>				</td>
>				<td width="75%" height="35"
>colspan="2">&nbsp;
>					<input type="text"
>name="txtAddr1" maxlength="100" value="Address 1"
>size="34">
>				</td>
>			</tr>
>			<tr>
>				<td width="25%" height="35">
>					&nbsp;&nbsp;<font
>face="Verdana" size="2" color="#000000">
>						<b>Address 2:</b>
>					</font>
>				</td>
>				<td width="75%" height="35"
>colspan="2">&nbsp;
>					<input type="text"
>name="txtAddr2" maxlength="100" value="Address 2"
>size="34">
>				</td>
>			</tr>
>----end----
>
>which with a velocimacro or equivalent I could rewrite so it
>*looked* like a
>table in the code, while maintaining the visual details that the
>webdesigner
>put in there. Writing a dedicated tapestry component seems much
>heavier than
>just defining a few macros, but I'm new to tapestry (and to web
>based stuff in
>general), so I'd love to hear of a better way to do it.
>
>martin
>
>__________________________________
>Do you Yahoo!?
>New Yahoo! Photos - easier uploading and sharing.
>http://photos.yahoo.com/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: tapestry and templating systems

Posted by Martin DeMello <ma...@yahoo.com>.
--- Dmitriy Kiriy <dk...@oilspace.com> wrote:
> What kind of "annoying html code that would be better expressed using
> velocimacros" do you found?
> 
> My experience for moving to Tapestry is: if developer think such, he just
> not understand what IS Tapestry in details.
> So, pls, provide an snippnet of annoying html code and what you want to see

The thing is, I've inherited an ASP application that I need to (i) port to java
(ii) enhance with several new features. The ASP pages were evidently written
using a wysiwyg designer, and have things like tables where there are colour
and font directives in every cell, nested tables and other verbose, nitpicky
details. I'm finding it fairly hard to see what's happening amidst all the
clutter, and have to keep scrolling back and forth to get context. Right now
I'm trying to retain the look and feel, while cutting down on the code
verbosity, so the first thing I thought of was some sort of macro system. 

Here's the sort of code I'm talking about:

------begin------

<tr>
	<td width="68%" align="left"  valign="top">   
		<table width="100%" cellspacing="0" cellpadding="0"
			border="1" style="border-collapse: collapse" 
			bordercolor=#808080>
			<tr>
				<td width="25%" height="35">
					<font face='Verdana' size='2' color='red'>*</font><font face='Verdana'
size='2' color='#000000'>
						<b>Org Title:</b>
					</font>
				</td>
				<td width="75%" height="35" colspan="2">&nbsp;
					<input type="text" name="txtOrgTtl"
					maxlength="50" value="Company" 
					size="34">
				</td>
			</tr>
			<tr>
				<td width="25%" height="35"> 
					<font face='Verdana' size='2' color='red'>*</font><font face='Verdana'
size='2' color='#000000'>
						<b>Address 1:</b>
					</font>
				</td>
				<td width="75%" height="35" colspan="2">&nbsp;
					<input type="text" name="txtAddr1" maxlength="100" value="Address 1"
size="34">
				</td>
			</tr>
			<tr>
				<td width="25%" height="35"> 
					&nbsp;&nbsp;<font face="Verdana" size="2" color="#000000">
						<b>Address 2:</b>
					</font>
				</td>
				<td width="75%" height="35" colspan="2">&nbsp;
					<input type="text" name="txtAddr2" maxlength="100" value="Address 2" 
size="34">
				</td>
			</tr>
----end----

which with a velocimacro or equivalent I could rewrite so it *looked* like a
table in the code, while maintaining the visual details that the webdesigner
put in there. Writing a dedicated tapestry component seems much heavier than
just defining a few macros, but I'm new to tapestry (and to web based stuff in
general), so I'd love to hear of a better way to do it.

martin

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: tapestry and templating systems

Posted by Dmitriy Kiriy <dk...@oilspace.com>.
What kind of "annoying html code that would be better expressed using
velocimacros" do you found?

My experience for moving to Tapestry is: if developer think such, he just
not understand what IS Tapestry in details.
So, pls, provide an snippnet of annoying html code and what you want to see

	Regs,
		dmitriy


>-----Original Message-----
>From: Martin DeMello [mailto:martindemello@yahoo.com]
>Sent: Wednesday, December 10, 2003 11:00 AM
>To: Tapestry users
>Subject: tapestry and templating systems
>
>
>Has anyone tried mixing tapestry with a templating system like velocity?
>There's a lot of annoying html code that would be better expressed using
>velocimacros (far lighter than defining tapestry components), but tapestry
>would need to invoke it before it processed the template, and I'm
>not sure how
>feasible that is.
>
>martin
>
>__________________________________
>Do you Yahoo!?
>New Yahoo! Photos - easier uploading and sharing.
>http://photos.yahoo.com/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org