Thanks Lewis. I can see what you mean. It does sound like I'm trying to do 
something action-oriented/Struts-like. I'm a big fan of the way Tapestry 
doesn't force you to think in this way and is more intuitive. The reason I ask 
actually, is more to do with wanting to re-skin pages based on a user. Ie. want 
the same content (so just need one page class), but Id like to use a different 
TML file altogether based on the user.
This way, I am hoping to work on 2 separate TML files in design mode, and the 
can be served based on which type of user is logged in. For example... a funky 
design versus a more mature design based on the age of the user. Sounds weird 
:-), but just wondering if there's an easy way to select the TML file at run 
time, that Tapestry uses with a single page class. I think the localization 
functionality would actually do just the trick if I just assign the funky 
styled tml file to one (eg. HomePage_fr.tml) and the refined one 
(HomePage_en.tml).

Then I can programatically set the local based on the logged in user. Does that 
sound like a completely deranged way of going about it? :-)

Thanks, 
Dave.










Mon, 6/20/11, Howard Lewis Ship [via Tapestry] 
<ml-node+4507472-1501312819-92...@n5.nabble.com> wrote:

From: Howard Lewis Ship [via Tapestry] 
<ml-node+4507472-1501312819-92...@n5.nabble.com>
Subject: Re: Can you dynamically select which page template to return?
To: "dkeenan" <david_siedle...@yahoo.co.uk>
Date: Monday, June 20, 2011, 7:49 PM



        On Mon, Jun 20, 2011 at 2:26 AM, dkeenan <[hidden email]> wrote:

> Not sure if that makes any sense but here goes... For each page in Tapestry,

> I know that I need to specify a page class, and a corresponding TML templage

> file for that page.

>


It's easy to make a single page dynamic, or to choose one of a number

of different pages to render the response.  I feel you may be sticking

too much to the action-oriented framework's view of actions & views;

in Tapestry a page is the combination of an action and a view. This

drives a lot of what Tapestry does for you, in terms of convention

over configuration, and all the plumbing and request handling that the

framework does automatically.


It's a good idea to backtrack from "I need to select two different

output views" back towards the actual user requirement or story. For

instance, "I need to display input validation errors" can be a

condtional portion of a single page.  Many other cases can be handled

in terms of having pages with different responsibilities. It's rather

hard to provide guidance in a vacuum.




> I was wondering if I can have more than one possible TML file for a page...

> and programatically decide which one to use?

>

> Hope makes sense.

>

> Dave.

>

>

> --

> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4505668.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.

>

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: [hidden email]

> For additional commands, e-mail: [hidden email]

>

>



-- 

Howard M. Lewis Ship


Creator of Apache Tapestry


The source for Tapestry training, mentoring and support. Contact me to

learn how I can get you up and productive in Tapestry fast!


(971) 678-5210

http://howardlewisship.com

---------------------------------------------------------------------

To unsubscribe, e-mail: [hidden email]

For additional commands, e-mail: [hidden email]



        
        

        

        
        
                If you reply to this email, your message will be added to the 
discussion below:
                
http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4507472.html
        
        
                
                To unsubscribe from Can you dynamically select which page 
template to return?, click here.
        

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4507615.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Reply via email to