You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lbastil <ba...@gmx.de> on 2007/11/02 15:42:44 UTC

[s2] templating approach / own tag?

Hi,

I want to archive the following:

I noticed in my page code often this redundant structure:
(dynamic parts in [])


<div id="headerTitle">
[Header Section Name]
</div>
<div id="headerContent">
[
... various different content, tables, ... and so on
]
</div>

Now I would like to create some parameterized template, something I could
call like:
(pseudocode):
<Section title="[Header Section Name]">
[
... various different content, tables, ... and so on
]
</Section>

which produces the code shown above dynamically.

How can I do this most easy with struts2 framework?
(in struts1 I would have created an own tag)

thank you in advance,
basti
-- 
View this message in context: http://www.nabble.com/-s2--templating-approach---own-tag--tf4737793.html#a13548784
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [s2] templating approach / own tag?

Posted by Antonio Petrelli <an...@gmail.com>.
Thinking on it a bit, Basti, I think that your best friend would be Sitemesh:
http://www.opensymphony.com/sitemesh/
If you have the same structure (or a small number of structures)
across all the application, this is the easier approach.
Struts 2 has a Sitemesh plugin too:
http://struts.apache.org/2.x/docs/sitemesh-plugin.html
Anyway, you can always use Tiles and Sitemesh together :-)

Antonio

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


Re: [s2] templating approach / own tag?

Posted by Antonio Petrelli <an...@gmail.com>.
2007/11/2, lbastil <ba...@gmx.de>:
>
>
> Thank you for this hint, but in this case I don't think so.
>
> I am already use tiles for the overall page structure, but for this
> minor substructures I don't want to use a kind of tiles sub-hierarchy.



Ok I think I understood: so you want a piece of code that, when run, creates
the HTML structures dynamically. Am I right?
In this case, I think you want to re-invent the wheel: it seems like an XML
to be transformed throught an XSLT file.
If you want to do so, use XML+XSLT, but I think that you are wasting time:
since Tiles and Sitemesh do a great job in templating, I suggest to use
them.
In particular, since you are talking about a microstructure, probably Tiles
will fit best, since Sitemesh is more "application-wide".

Just my 2 eurocents
Antonio

Re: [s2] templating approach / own tag?

Posted by Antonio Petrelli <an...@gmail.com>.
2007/11/9, lbastil <ba...@gmx.de>:
>
>
> But what I originally thought of was something like parametrized approach
> of:
> http://www.vitarara.org/cms/struts_2_cookbook/creating_a_ui_component
>
> (I think for smaller substructures it could be reasonable)



Ah ok so you wanted to create an UI component!
I thought that you wanted to create a page layout, not a UI component: in
this case you are right, creating a custom Struts 2 UI component is the best
choice...
I hope it is not too late :-)

Antonio

Re: [s2] templating approach / own tag?

Posted by lbastil <ba...@gmx.de>.
Thank you all for the hints.

Finally I used tiles as it was recommended.

But what I originally thought of was something like parametrized approach
of:
http://www.vitarara.org/cms/struts_2_cookbook/creating_a_ui_component

(I think for smaller substructures it could be reasonable)

basti


newton.dave wrote:
> 
> You can still create custom tags in Java if you're
> dead-set on it.
> 
> Or you can use JSP 2.0 tags, where your tag
> implementation is in JSP.
> 
> There are a lot of ways of doing what you're trying to
> do. I don't know why you're opposed to using tiles,
> particularly if you're already invested in it.
> 
> d.
> 
> --- lbastil <ba...@gmx.de> wrote:
> 
>> 
>> Thank you for this hint, but in this case I don't
>> think so.
>> 
>> I am already use tiles for the overall page
>> structure, but for this
>> minor substructures I don't want to use a kind of
>> tiles sub-hierarchy.
>> 
>> Is there no equivalence to former custom tag?
>> 
>> Something like a ftl-script I can apply
>> parametrized?
>> 
>> Thank you,
>> basti   
>> 
>> 
>> Antonio Petrelli-3 wrote:
>> > 
>> > 2007/11/2, lbastil <ba...@gmx.de>:
>> >>
>> >>
>> >> Hi,
>> >>
>> >> I want to archive the following:
>> >>
>> >> I noticed in my page code often this redundant
>> structure:
>> >> (dynamic parts in [])
>> >>
>> >>
>> >> <div id="headerTitle">
>> >> [Header Section Name]
>> >> </div>
>> >> <div id="headerContent">
>> >> [
>> >> ... various different content, tables, ... and so
>> on
>> >> ]
>> >> </div>
>> >>
>> >> Now I would like to create some parameterized
>> template, something I could
>> >> call like:
>> >> (pseudocode):
>> >> <Section title="[Header Section Name]">
>> >> [
>> >> ... various different content, tables, ... and so
>> on
>> >> ]
>> >> </Section>
>> >>
>> >> which produces the code shown above dynamically.
>> >>
>> >> How can I do this most easy with struts2
>> framework?
>> >> (in struts1 I would have created an own tag)
>> > 
>> > 
>> > 
>> > I think this is a task for Tiles :-)
>> > http://tiles.apache.org/
>> > Struts 2 contains a Tiles plugin:
>> >
>> http://struts.apache.org/2.x/docs/tiles-plugin.html
>> > 
>> > Antonio
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/-s2--templating-approach---own-tag--tf4737793.html#a13549228
>> Sent from the Struts - User mailing list archive at
>> Nabble.com.
>> 
>> 
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-s2--templating-approach---own-tag--tf4737793.html#a13665643
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [s2] templating approach / own tag?

Posted by Dave Newton <ne...@yahoo.com>.
You can still create custom tags in Java if you're
dead-set on it.

Or you can use JSP 2.0 tags, where your tag
implementation is in JSP.

There are a lot of ways of doing what you're trying to
do. I don't know why you're opposed to using tiles,
particularly if you're already invested in it.

d.

--- lbastil <ba...@gmx.de> wrote:

> 
> Thank you for this hint, but in this case I don't
> think so.
> 
> I am already use tiles for the overall page
> structure, but for this
> minor substructures I don't want to use a kind of
> tiles sub-hierarchy.
> 
> Is there no equivalence to former custom tag?
> 
> Something like a ftl-script I can apply
> parametrized?
> 
> Thank you,
> basti   
> 
> 
> Antonio Petrelli-3 wrote:
> > 
> > 2007/11/2, lbastil <ba...@gmx.de>:
> >>
> >>
> >> Hi,
> >>
> >> I want to archive the following:
> >>
> >> I noticed in my page code often this redundant
> structure:
> >> (dynamic parts in [])
> >>
> >>
> >> <div id="headerTitle">
> >> [Header Section Name]
> >> </div>
> >> <div id="headerContent">
> >> [
> >> ... various different content, tables, ... and so
> on
> >> ]
> >> </div>
> >>
> >> Now I would like to create some parameterized
> template, something I could
> >> call like:
> >> (pseudocode):
> >> <Section title="[Header Section Name]">
> >> [
> >> ... various different content, tables, ... and so
> on
> >> ]
> >> </Section>
> >>
> >> which produces the code shown above dynamically.
> >>
> >> How can I do this most easy with struts2
> framework?
> >> (in struts1 I would have created an own tag)
> > 
> > 
> > 
> > I think this is a task for Tiles :-)
> > http://tiles.apache.org/
> > Struts 2 contains a Tiles plugin:
> >
> http://struts.apache.org/2.x/docs/tiles-plugin.html
> > 
> > Antonio
> > 
> > 
> 
> -- 
> View this message in context:
>
http://www.nabble.com/-s2--templating-approach---own-tag--tf4737793.html#a13549228
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


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


Re: [s2] templating approach / own tag?

Posted by lbastil <ba...@gmx.de>.
Thank you for this hint, but in this case I don't think so.

I am already use tiles for the overall page structure, but for this
minor substructures I don't want to use a kind of tiles sub-hierarchy.

Is there no equivalence to former custom tag?

Something like a ftl-script I can apply parametrized?

Thank you,
basti   


Antonio Petrelli-3 wrote:
> 
> 2007/11/2, lbastil <ba...@gmx.de>:
>>
>>
>> Hi,
>>
>> I want to archive the following:
>>
>> I noticed in my page code often this redundant structure:
>> (dynamic parts in [])
>>
>>
>> <div id="headerTitle">
>> [Header Section Name]
>> </div>
>> <div id="headerContent">
>> [
>> ... various different content, tables, ... and so on
>> ]
>> </div>
>>
>> Now I would like to create some parameterized template, something I could
>> call like:
>> (pseudocode):
>> <Section title="[Header Section Name]">
>> [
>> ... various different content, tables, ... and so on
>> ]
>> </Section>
>>
>> which produces the code shown above dynamically.
>>
>> How can I do this most easy with struts2 framework?
>> (in struts1 I would have created an own tag)
> 
> 
> 
> I think this is a task for Tiles :-)
> http://tiles.apache.org/
> Struts 2 contains a Tiles plugin:
> http://struts.apache.org/2.x/docs/tiles-plugin.html
> 
> Antonio
> 
> 

-- 
View this message in context: http://www.nabble.com/-s2--templating-approach---own-tag--tf4737793.html#a13549228
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [s2] templating approach / own tag?

Posted by Antonio Petrelli <an...@gmail.com>.
2007/11/2, lbastil <ba...@gmx.de>:
>
>
> Hi,
>
> I want to archive the following:
>
> I noticed in my page code often this redundant structure:
> (dynamic parts in [])
>
>
> <div id="headerTitle">
> [Header Section Name]
> </div>
> <div id="headerContent">
> [
> ... various different content, tables, ... and so on
> ]
> </div>
>
> Now I would like to create some parameterized template, something I could
> call like:
> (pseudocode):
> <Section title="[Header Section Name]">
> [
> ... various different content, tables, ... and so on
> ]
> </Section>
>
> which produces the code shown above dynamically.
>
> How can I do this most easy with struts2 framework?
> (in struts1 I would have created an own tag)



I think this is a task for Tiles :-)
http://tiles.apache.org/
Struts 2 contains a Tiles plugin:
http://struts.apache.org/2.x/docs/tiles-plugin.html

Antonio

Re: [s2] templating approach / own tag?

Posted by Antonio Petrelli <an...@gmail.com>.
2007/11/2, Rod Bollinger <te...@portablegenius.com>:
>
> Tiles (and in Struts 1? Tiles) :-)



And for the newcoming Struts 1.4, Tiles 2 :-)
Sorry for the advertisement :-P

Antonio

RE: [s2] templating approach / own tag?

Posted by Rod Bollinger <te...@portablegenius.com>.
Tiles (and in Struts 1? Tiles) :-)

http://struts.apache.org/1.x/struts-tiles/


-Rod

-----Original Message-----
From: lbastil [mailto:basti-unterwegs@gmx.de] 
Sent: Friday, November 02, 2007 10:43
To: user@struts.apache.org
Subject: [s2] templating approach / own tag?


Hi,

I want to archive the following:

I noticed in my page code often this redundant structure:
(dynamic parts in [])


<div id="headerTitle">
[Header Section Name]
</div>
<div id="headerContent">
[
... various different content, tables, ... and so on
]
</div>

Now I would like to create some parameterized template, something I could
call like:
(pseudocode):
<Section title="[Header Section Name]">
[
... various different content, tables, ... and so on
]
</Section>

which produces the code shown above dynamically.

How can I do this most easy with struts2 framework?
(in struts1 I would have created an own tag)

thank you in advance,
basti
-- 
View this message in context:
http://www.nabble.com/-s2--templating-approach---own-tag--tf4737793.html#a13
548784
Sent from the Struts - User mailing list archive at Nabble.com.


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




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