You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Smith <je...@centralscheduling.net> on 2003/03/16 01:48:25 UTC

[Q] Accessing struts-tiles attribute in a bean?

James and Dan turned me on to tiles. I love them - as I love any tool that
simplifies what I was already doing via brute force. :-)

I feel I'm on the verge of a new level of understanding, but sadly, haven't
quite crossed over.

In my tiles structure, I want to have my pages get their titles from the
application resource.

So I dutifully created a titleKey attribute in my tile-description.xml, like
so:
<definition name="StandardLayout" path="/Jsps/Templates/TemplateMain.jsp">
  <put name="titleKey" value="some.resource.key"/>
  <put name="header" value="/Jsps/Tiles/TileHeader.jsp"/>
  <put name="content" value="/Jsps/Tiles/TileWelcome.jsp"/>
  <put name="menu" value="/Jsps/Tiles/TileMenu.jsp"/>
</definition>

In my TemplateMain.jsp, I want to take that titleKey and look up the proper
title string from my application resource file.

But I can't figure out how to access the value of the titleKey attribute
into the key field of the bean:message tag.

Is this possible?

One day a light will go on in my head, and I won't feel so confused by all
this. :-)

Jefficus


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


RE: test

Posted by Andrew Hill <an...@gridnode.com>.
ffkkkku2

-----Original Message-----
From: Niket Anand [mailto:niket@noida.manystreams.com]
Sent: Monday, 17 March 2003 15:40
To: Struts Users Mailing List
Subject: test







ffkkkk



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

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


test

Posted by Niket Anand <ni...@noida.manystreams.com>.




ffkkkk



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


Re: [Q] Accessing struts-tiles attribute in a bean?

Posted by Dan Allen <da...@mojavelinux.com>.
> Not sure of 'best' way to this but I think this may work:
> 
> <tiles:useAttribute name="booboo" classname="java.lang.String" />
> 
> ...
> 
> <bean:message key="<%=booboo%>" />

...or with bean-el you can do

<bean:message key="${booboo}"/>

I do this as well as tiles does not support localization just yet.
However, it looks like it will be implemented in the future as there
are several bugzilla reports on it.  Conception would of course be
to set "key" attribute in tiles.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
[Frodo]: "I wish it need not have happened in my time." 
[Gandalf]: "So do I, and so do all who live to see such times. 
But that is not for them to decide. All we have to decide is 
what we do with the time that is given to us.'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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


RE: [Q] Accessing struts-tiles attribute in a bean?

Posted by Hue Holleran <hu...@openAction.net>.
Great links, Thanks Ted.

I suppose the ultimate objective (imho) would be to extend tiles so it could
utilise other views rather than just jsp. This could then leverage the great
work Cedric has done on tiles wrt XML definitions and 'extends' definitions.

Sorry if this seems like a really dumb/lazy q but how does the .vm get
passed to velocity for processing - is this just via a <servlet-mapping> in
web.xml. If so, could tiles not be extended to also pass the appropriate
extension to a servlet mapping for processing? (Has anyone run any ideas
past Cedric?).

I'm not advocating even stronger dependence between the components - as I
know you have strong and I think perfectly justifiable views on this - but
tiles allowing a different processing engine for a resource could be very
powerful. Ok, it could be tiles already does this - and I'm just rambling.
I'll have a look again at the tiles code and try some examples before
posting again.

H.

-----Original Message-----
From: Ted Husted [mailto:ted@husted.com]
Sent: 17 March 2003 09:31
To: Hue Holleran
Cc: 'Struts Users Mailing List'; scott@exergonic.com.au
Subject: Re: [Q] Accessing struts-tiles attribute in a bean?


Hue Holleran wrote:
> Ted - what's the chance of posting your views (or pointing us to a link)
on
> how you're using Velocity with Struts. I did have another look at Velocity
> after your presentation but I still don't think I can do without tiles -
> even with the promise of 'cross platform' Velocity.NET/NVelocity it
doesn't
> do it for me?

I should probably do a how-to, but here's a clip from a "Tiles Support"
thread on the Velocity User list:

=====

Mark de Reeper wrote:
#parse("/WEB-INF/templates/vm/htmlheader.vm")
<table width="100%" border="0">
     <tr>
         <td>#if($header)#parse($header)#end</td>
     </tr>
     <tr>
         <td>#if($body)#parse($body)#end</td>
     </tr>
     <tr>
         <td>#if($footer)#parse($footer)#end</td>
     </tr>
</table>
#parse("/WEB-INF/templates/vm/htmlfooter.vm")

Then define a template to set the layout and the various bits, this is
what is loaded as the main template to parse:

#set ($body = "/WEB-INF/templates/vm/templatebody.vm")
#set ($footer = "/WEB-INF/templates/vm/templatefooter.vm")
#set ($header = "/WEB-INF/templates/vm/templateheader.vm")
#parse("/WEB-INF/templates/layouts/layoutHBF.vm")

Ted Husted wrote:
This is just how the original Struts Template library worked. (Great
minds and all that.) You defined a second file to administer the
template. This works well enough but it tends to generate a lot of
"meta-templates" that are just used to call other templates.

As Slavik pointed out, Tiles extended the template library so that you
could express the "meta-templates" in XML. Instead of forwarding to the
"glockenspiel.vm" template, you can foward to make a reference to say
"/vm/Glockenspiel" and Struts will automatically look for a
vmGlockenspiel element, do whatever sets you need, and the forward to
the layout.

A very neat aspect of Tiles, that we need to adopt for the other Struts
configurations, is that one element can extend another. So if you just
needed to replace the title on a page, you can extend one element and
just "override" that one set. This makes a *huge* difference in
maintenance when you pass the thirty page mark.

Until one of us gets around to writing a Tiles tool, I've prototyped
what you can do in the Struts config. I've a ViewAction that does the
setting. You create the variables to set as Struts ActionForwards and
pass their names to ViewAction as ActionMapping parameter. So I have
something like this to describe a page:

<action path="/vm/main/permit/View"
  type="us_ok_deq_wqdata.http.ViewAction"
  validate="false"
  name="permit_select_id"
  parameter="vmTitle,vmChoice,vmMenu,vmBody,vmAction,vmButtonBar">
    <forward name="vmTitle" path="Permit Detail" />
    <forward name="vmChoice" path="View" />
    <forward name="vmMenu" path="/cpu/menu/main.vm" />
    <forward name="vmBody" path="/cpu/permit/view.vm" />
    <forward name="vmAction" redirect="false" path="/Main" />
    <forward name="vmButtonBar" path="/cpu/permit/viewMain.vm" />
</action>

To render the same "page" but with a different button bar, I'd just
change that forward to include some other template instead.

Besides URI's for parse statements, you can also pass any variable you
need to create. For example, "vmChoice" tells the menu which item we are
on, so it can dim that one (and leave the rest linked).

While we can't extend struts-config elements (yet), the ActionForwards
do have a local and global scope. So you can do things like create a
global default forward and let that pass through when it doesn't need to
be changed. This is done for the Layout. There's a default "vmLayout"
forward which can be overridden by an element if you need to use a
different layout.

This works fine inside of Struts and will work even better when we get
the Struts config to support extended elements like the Tiles config.
But, it seems to me that it's something that could also be done outside
of Struts and made available to anyone using Velocity.

For programmers, this sort of thing makes the templates feel
object-orientated. You can define a base element and then extend it to
say what changes. For designers, they can use Velocity templates seem
more like fill-in-the-blank Dreamweaver templates. A GUI, like Struts
Console, can even save you from mucking about with XML.

-Ted.

=====


For more see,
<
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg09304.html >

There's a copy of my ViewAction at
<
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/wqdata/src/java/shared/org_ap
ache_struts_scaffold/ViewAction.java
 >



--
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>




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


Re: [Q] Accessing struts-tiles attribute in a bean?

Posted by Ted Husted <te...@husted.com>.
Hue Holleran wrote:
> Ted - what's the chance of posting your views (or pointing us to a link) on
> how you're using Velocity with Struts. I did have another look at Velocity
> after your presentation but I still don't think I can do without tiles -
> even with the promise of 'cross platform' Velocity.NET/NVelocity it doesn't
> do it for me?

I should probably do a how-to, but here's a clip from a "Tiles Support" 
thread on the Velocity User list:

=====

Mark de Reeper wrote:
#parse("/WEB-INF/templates/vm/htmlheader.vm")
<table width="100%" border="0">
     <tr>
         <td>#if($header)#parse($header)#end</td>
     </tr>
     <tr>
         <td>#if($body)#parse($body)#end</td>
     </tr>
     <tr>
         <td>#if($footer)#parse($footer)#end</td>
     </tr>
</table>
#parse("/WEB-INF/templates/vm/htmlfooter.vm")

Then define a template to set the layout and the various bits, this is 
what is loaded as the main template to parse:

#set ($body = "/WEB-INF/templates/vm/templatebody.vm")
#set ($footer = "/WEB-INF/templates/vm/templatefooter.vm")
#set ($header = "/WEB-INF/templates/vm/templateheader.vm")
#parse("/WEB-INF/templates/layouts/layoutHBF.vm")

Ted Husted wrote:
This is just how the original Struts Template library worked. (Great 
minds and all that.) You defined a second file to administer the 
template. This works well enough but it tends to generate a lot of 
"meta-templates" that are just used to call other templates.

As Slavik pointed out, Tiles extended the template library so that you 
could express the "meta-templates" in XML. Instead of forwarding to the 
"glockenspiel.vm" template, you can foward to make a reference to say 
"/vm/Glockenspiel" and Struts will automatically look for a 
vmGlockenspiel element, do whatever sets you need, and the forward to 
the layout.

A very neat aspect of Tiles, that we need to adopt for the other Struts 
configurations, is that one element can extend another. So if you just 
needed to replace the title on a page, you can extend one element and 
just "override" that one set. This makes a *huge* difference in 
maintenance when you pass the thirty page mark.

Until one of us gets around to writing a Tiles tool, I've prototyped 
what you can do in the Struts config. I've a ViewAction that does the 
setting. You create the variables to set as Struts ActionForwards and 
pass their names to ViewAction as ActionMapping parameter. So I have 
something like this to describe a page:

<action path="/vm/main/permit/View"
  type="us_ok_deq_wqdata.http.ViewAction"
  validate="false"
  name="permit_select_id"
  parameter="vmTitle,vmChoice,vmMenu,vmBody,vmAction,vmButtonBar">
    <forward name="vmTitle" path="Permit Detail" />
    <forward name="vmChoice" path="View" />
    <forward name="vmMenu" path="/cpu/menu/main.vm" />
    <forward name="vmBody" path="/cpu/permit/view.vm" />
    <forward name="vmAction" redirect="false" path="/Main" />
    <forward name="vmButtonBar" path="/cpu/permit/viewMain.vm" />
</action>

To render the same "page" but with a different button bar, I'd just 
change that forward to include some other template instead.

Besides URI's for parse statements, you can also pass any variable you 
need to create. For example, "vmChoice" tells the menu which item we are 
on, so it can dim that one (and leave the rest linked).

While we can't extend struts-config elements (yet), the ActionForwards 
do have a local and global scope. So you can do things like create a 
global default forward and let that pass through when it doesn't need to 
be changed. This is done for the Layout. There's a default "vmLayout" 
forward which can be overridden by an element if you need to use a 
different layout.

This works fine inside of Struts and will work even better when we get 
the Struts config to support extended elements like the Tiles config. 
But, it seems to me that it's something that could also be done outside 
of Struts and made available to anyone using Velocity.

For programmers, this sort of thing makes the templates feel 
object-orientated. You can define a base element and then extend it to 
say what changes. For designers, they can use Velocity templates seem 
more like fill-in-the-blank Dreamweaver templates. A GUI, like Struts 
Console, can even save you from mucking about with XML.

-Ted.

=====


For more see,
< 
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg09304.html >

There's a copy of my ViewAction at
< 
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/wqdata/src/java/shared/org_apache_struts_scaffold/ViewAction.java 
 >



-- 
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>


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


RE: [Q] Accessing struts-tiles attribute in a bean?

Posted by Hue Holleran <hu...@openAction.net>.
tiles-documentation.war

http://nagoya.apache.org/eyebrowse/ReadMsg?listName=struts-user@jakarta.apac
he.org&msgNo=64863

-----Original Message-----
From: Kola Oyedeji [mailto:kola.oyedeji@iclployalty.com]
Sent: 17 March 2003 09:31
To: 'Struts Users Mailing List'
Subject: RE: [Q] Accessing struts-tiles attribute in a bean?


Hi

I've been trying to get to grips with Tiles, can anyone point me to some
resources, there seems to be a lack of information available on them.

Thanks

Kola

>> -----Original Message-----
>> From: Hue Holleran [mailto:hueh@openAction.net]
>> Sent: 17 March 2003 08:16
>> To: 'Struts Users Mailing List'; scott@exergonic.com.au
>> Cc: ted@husted.com
>> Subject: RE: [Q] Accessing struts-tiles attribute in a bean?
>>
>> Ted (Husted) has created a 'tiles for Velocity'. He did qualify that
by
>> saying it was not as fully-featured as Cedric's - as I think original
>> tiles
>> took a good while to develop - but Ted's was designed in the shower
(or
>> bath - I don't recall) and then developed quickly afterwards.
>>
>> However, that said - I'd be really interested in taking a look at
that
>> code - maybe his new book could be 'Struts on Speed' (not the author
as
>> he'd
>> never get on those stilts - but Struts with Velocity).
>>
>> Ted - what's the chance of posting your views (or pointing us to a
link)
>> on
>> how you're using Velocity with Struts. I did have another look at
>> Velocity
>> after your presentation but I still don't think I can do without
tiles -
>> even with the promise of 'cross platform' Velocity.NET/NVelocity it
>> doesn't
>> do it for me?
>>
>> H.
>>
>> -----Original Message-----
>> From: Scott Barr [mailto:scott@exergonic.com.au]
>> Sent: 17 March 2003 05:02
>> To: 'Struts Users Mailing List'
>> Subject: RE: [Q] Accessing struts-tiles attribute in a bean?
>>
>>
>>
>> Yeah, I'm exacly the same with Velocity. It is clean as a whistle,
but
>> I've gotta have my Tiles :)
>>
>> Scott Barr
>> www.exergonic.com.au
>>
>>
>> On Mon, 2003-03-17 at 04:49, Hue Holleran wrote:
>> > Not sure of 'best' way to this but I think this may work:
>> >
>> > <tiles:useAttribute name="booboo" classname="java.lang.String" />
>> >
>> > ...
>> >
>> > <bean:message key="<%=booboo%>" />
>> >
>> > Yes, I agree tiles is great - been looking at Velocity again just
>> recently
>> > but I just don't think I could live without tiles now. There always
>> seems
>> to
>> > be more to discover with tiles and so many ways it can be extended
to
>> suit
>> > new requirements.
>> >
>> > H.
>> >
>> > -----Original Message-----
>> > From: Jeff Smith [mailto:jeffs@centralscheduling.net]
>> > Sent: 16 March 2003 00:48
>> > To: Struts Users Mailing List
>> > Subject: [Q] Accessing struts-tiles attribute in a bean?
>> >
>> >
>> > James and Dan turned me on to tiles. I love them - as I love any
tool
>> that
>> > simplifies what I was already doing via brute force. :-)
>> >
>> > I feel I'm on the verge of a new level of understanding, but sadly,
>> haven't
>> > quite crossed over.
>> >
>> > In my tiles structure, I want to have my pages get their titles
from
>> the
>> > application resource.
>> >
>> > So I dutifully created a titleKey attribute in my
tile-description.xml,
>> like
>> > so:
>> > <definition name="StandardLayout"
>> path="/Jsps/Templates/TemplateMain.jsp">
>> >   <put name="titleKey" value="some.resource.key"/>
>> >   <put name="header" value="/Jsps/Tiles/TileHeader.jsp"/>
>> >   <put name="content" value="/Jsps/Tiles/TileWelcome.jsp"/>
>> >   <put name="menu" value="/Jsps/Tiles/TileMenu.jsp"/>
>> > </definition>
>> >
>> > In my TemplateMain.jsp, I want to take that titleKey and look up
the
>> proper
>> > title string from my application resource file.
>> >
>> > But I can't figure out how to access the value of the titleKey
>> attribute
>> > into the key field of the bean:message tag.
>> >
>> > Is this possible?
>> >
>> > One day a light will go on in my head, and I won't feel so confused
by
>> all
>> > this. :-)
>> >
>> > Jefficus
>> >
>> >
>> >
---------------------------------------------------------------------
>> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail:
struts-user-help@jakarta.apache.org
>> >
>> >
>> >
>> >
>> >
---------------------------------------------------------------------
>> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail:
struts-user-help@jakarta.apache.org
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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




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


RE: [Q] Accessing struts-tiles attribute in a bean?

Posted by Kola Oyedeji <ko...@iclployalty.com>.
Hi

I've been trying to get to grips with Tiles, can anyone point me to some
resources, there seems to be a lack of information available on them.

Thanks

Kola

>> -----Original Message-----
>> From: Hue Holleran [mailto:hueh@openAction.net]
>> Sent: 17 March 2003 08:16
>> To: 'Struts Users Mailing List'; scott@exergonic.com.au
>> Cc: ted@husted.com
>> Subject: RE: [Q] Accessing struts-tiles attribute in a bean?
>> 
>> Ted (Husted) has created a 'tiles for Velocity'. He did qualify that
by
>> saying it was not as fully-featured as Cedric's - as I think original
>> tiles
>> took a good while to develop - but Ted's was designed in the shower
(or
>> bath - I don't recall) and then developed quickly afterwards.
>> 
>> However, that said - I'd be really interested in taking a look at
that
>> code - maybe his new book could be 'Struts on Speed' (not the author
as
>> he'd
>> never get on those stilts - but Struts with Velocity).
>> 
>> Ted - what's the chance of posting your views (or pointing us to a
link)
>> on
>> how you're using Velocity with Struts. I did have another look at
>> Velocity
>> after your presentation but I still don't think I can do without
tiles -
>> even with the promise of 'cross platform' Velocity.NET/NVelocity it
>> doesn't
>> do it for me?
>> 
>> H.
>> 
>> -----Original Message-----
>> From: Scott Barr [mailto:scott@exergonic.com.au]
>> Sent: 17 March 2003 05:02
>> To: 'Struts Users Mailing List'
>> Subject: RE: [Q] Accessing struts-tiles attribute in a bean?
>> 
>> 
>> 
>> Yeah, I'm exacly the same with Velocity. It is clean as a whistle,
but
>> I've gotta have my Tiles :)
>> 
>> Scott Barr
>> www.exergonic.com.au
>> 
>> 
>> On Mon, 2003-03-17 at 04:49, Hue Holleran wrote:
>> > Not sure of 'best' way to this but I think this may work:
>> >
>> > <tiles:useAttribute name="booboo" classname="java.lang.String" />
>> >
>> > ...
>> >
>> > <bean:message key="<%=booboo%>" />
>> >
>> > Yes, I agree tiles is great - been looking at Velocity again just
>> recently
>> > but I just don't think I could live without tiles now. There always
>> seems
>> to
>> > be more to discover with tiles and so many ways it can be extended
to
>> suit
>> > new requirements.
>> >
>> > H.
>> >
>> > -----Original Message-----
>> > From: Jeff Smith [mailto:jeffs@centralscheduling.net]
>> > Sent: 16 March 2003 00:48
>> > To: Struts Users Mailing List
>> > Subject: [Q] Accessing struts-tiles attribute in a bean?
>> >
>> >
>> > James and Dan turned me on to tiles. I love them - as I love any
tool
>> that
>> > simplifies what I was already doing via brute force. :-)
>> >
>> > I feel I'm on the verge of a new level of understanding, but sadly,
>> haven't
>> > quite crossed over.
>> >
>> > In my tiles structure, I want to have my pages get their titles
from
>> the
>> > application resource.
>> >
>> > So I dutifully created a titleKey attribute in my
tile-description.xml,
>> like
>> > so:
>> > <definition name="StandardLayout"
>> path="/Jsps/Templates/TemplateMain.jsp">
>> >   <put name="titleKey" value="some.resource.key"/>
>> >   <put name="header" value="/Jsps/Tiles/TileHeader.jsp"/>
>> >   <put name="content" value="/Jsps/Tiles/TileWelcome.jsp"/>
>> >   <put name="menu" value="/Jsps/Tiles/TileMenu.jsp"/>
>> > </definition>
>> >
>> > In my TemplateMain.jsp, I want to take that titleKey and look up
the
>> proper
>> > title string from my application resource file.
>> >
>> > But I can't figure out how to access the value of the titleKey
>> attribute
>> > into the key field of the bean:message tag.
>> >
>> > Is this possible?
>> >
>> > One day a light will go on in my head, and I won't feel so confused
by
>> all
>> > this. :-)
>> >
>> > Jefficus
>> >
>> >
>> >
---------------------------------------------------------------------
>> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail:
struts-user-help@jakarta.apache.org
>> >
>> >
>> >
>> >
>> >
---------------------------------------------------------------------
>> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail:
struts-user-help@jakarta.apache.org
>> >
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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


RE: [Q] Accessing struts-tiles attribute in a bean?

Posted by Hue Holleran <hu...@openAction.net>.
Ted (Husted) has created a 'tiles for Velocity'. He did qualify that by
saying it was not as fully-featured as Cedric's - as I think original tiles
took a good while to develop - but Ted's was designed in the shower (or
bath - I don't recall) and then developed quickly afterwards.

However, that said - I'd be really interested in taking a look at that
code - maybe his new book could be 'Struts on Speed' (not the author as he'd
never get on those stilts - but Struts with Velocity).

Ted - what's the chance of posting your views (or pointing us to a link) on
how you're using Velocity with Struts. I did have another look at Velocity
after your presentation but I still don't think I can do without tiles -
even with the promise of 'cross platform' Velocity.NET/NVelocity it doesn't
do it for me?

H.

-----Original Message-----
From: Scott Barr [mailto:scott@exergonic.com.au]
Sent: 17 March 2003 05:02
To: 'Struts Users Mailing List'
Subject: RE: [Q] Accessing struts-tiles attribute in a bean?



Yeah, I'm exacly the same with Velocity. It is clean as a whistle, but
I've gotta have my Tiles :)

Scott Barr
www.exergonic.com.au


On Mon, 2003-03-17 at 04:49, Hue Holleran wrote:
> Not sure of 'best' way to this but I think this may work:
>
> <tiles:useAttribute name="booboo" classname="java.lang.String" />
>
> ...
>
> <bean:message key="<%=booboo%>" />
>
> Yes, I agree tiles is great - been looking at Velocity again just recently
> but I just don't think I could live without tiles now. There always seems
to
> be more to discover with tiles and so many ways it can be extended to suit
> new requirements.
>
> H.
>
> -----Original Message-----
> From: Jeff Smith [mailto:jeffs@centralscheduling.net]
> Sent: 16 March 2003 00:48
> To: Struts Users Mailing List
> Subject: [Q] Accessing struts-tiles attribute in a bean?
>
>
> James and Dan turned me on to tiles. I love them - as I love any tool that
> simplifies what I was already doing via brute force. :-)
>
> I feel I'm on the verge of a new level of understanding, but sadly,
haven't
> quite crossed over.
>
> In my tiles structure, I want to have my pages get their titles from the
> application resource.
>
> So I dutifully created a titleKey attribute in my tile-description.xml,
like
> so:
> <definition name="StandardLayout" path="/Jsps/Templates/TemplateMain.jsp">
>   <put name="titleKey" value="some.resource.key"/>
>   <put name="header" value="/Jsps/Tiles/TileHeader.jsp"/>
>   <put name="content" value="/Jsps/Tiles/TileWelcome.jsp"/>
>   <put name="menu" value="/Jsps/Tiles/TileMenu.jsp"/>
> </definition>
>
> In my TemplateMain.jsp, I want to take that titleKey and look up the
proper
> title string from my application resource file.
>
> But I can't figure out how to access the value of the titleKey attribute
> into the key field of the bean:message tag.
>
> Is this possible?
>
> One day a light will go on in my head, and I won't feel so confused by all
> this. :-)
>
> Jefficus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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




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


RE: [Q] Accessing struts-tiles attribute in a bean?

Posted by Scott Barr <sc...@exergonic.com.au>.
Yeah, I'm exacly the same with Velocity. It is clean as a whistle, but
I've gotta have my Tiles :)

Scott Barr
www.exergonic.com.au


On Mon, 2003-03-17 at 04:49, Hue Holleran wrote:
> Not sure of 'best' way to this but I think this may work:
> 
> <tiles:useAttribute name="booboo" classname="java.lang.String" />
> 
> ...
> 
> <bean:message key="<%=booboo%>" />
> 
> Yes, I agree tiles is great - been looking at Velocity again just recently
> but I just don't think I could live without tiles now. There always seems to
> be more to discover with tiles and so many ways it can be extended to suit
> new requirements.
> 
> H.
> 
> -----Original Message-----
> From: Jeff Smith [mailto:jeffs@centralscheduling.net]
> Sent: 16 March 2003 00:48
> To: Struts Users Mailing List
> Subject: [Q] Accessing struts-tiles attribute in a bean?
> 
> 
> James and Dan turned me on to tiles. I love them - as I love any tool that
> simplifies what I was already doing via brute force. :-)
> 
> I feel I'm on the verge of a new level of understanding, but sadly, haven't
> quite crossed over.
> 
> In my tiles structure, I want to have my pages get their titles from the
> application resource.
> 
> So I dutifully created a titleKey attribute in my tile-description.xml, like
> so:
> <definition name="StandardLayout" path="/Jsps/Templates/TemplateMain.jsp">
>   <put name="titleKey" value="some.resource.key"/>
>   <put name="header" value="/Jsps/Tiles/TileHeader.jsp"/>
>   <put name="content" value="/Jsps/Tiles/TileWelcome.jsp"/>
>   <put name="menu" value="/Jsps/Tiles/TileMenu.jsp"/>
> </definition>
> 
> In my TemplateMain.jsp, I want to take that titleKey and look up the proper
> title string from my application resource file.
> 
> But I can't figure out how to access the value of the titleKey attribute
> into the key field of the bean:message tag.
> 
> Is this possible?
> 
> One day a light will go on in my head, and I won't feel so confused by all
> this. :-)
> 
> Jefficus
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


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


RE: [Q] Accessing struts-tiles attribute in a bean?

Posted by Hue Holleran <hu...@openAction.net>.
Not sure of 'best' way to this but I think this may work:

<tiles:useAttribute name="booboo" classname="java.lang.String" />

...

<bean:message key="<%=booboo%>" />

Yes, I agree tiles is great - been looking at Velocity again just recently
but I just don't think I could live without tiles now. There always seems to
be more to discover with tiles and so many ways it can be extended to suit
new requirements.

H.

-----Original Message-----
From: Jeff Smith [mailto:jeffs@centralscheduling.net]
Sent: 16 March 2003 00:48
To: Struts Users Mailing List
Subject: [Q] Accessing struts-tiles attribute in a bean?


James and Dan turned me on to tiles. I love them - as I love any tool that
simplifies what I was already doing via brute force. :-)

I feel I'm on the verge of a new level of understanding, but sadly, haven't
quite crossed over.

In my tiles structure, I want to have my pages get their titles from the
application resource.

So I dutifully created a titleKey attribute in my tile-description.xml, like
so:
<definition name="StandardLayout" path="/Jsps/Templates/TemplateMain.jsp">
  <put name="titleKey" value="some.resource.key"/>
  <put name="header" value="/Jsps/Tiles/TileHeader.jsp"/>
  <put name="content" value="/Jsps/Tiles/TileWelcome.jsp"/>
  <put name="menu" value="/Jsps/Tiles/TileMenu.jsp"/>
</definition>

In my TemplateMain.jsp, I want to take that titleKey and look up the proper
title string from my application resource file.

But I can't figure out how to access the value of the titleKey attribute
into the key field of the bean:message tag.

Is this possible?

One day a light will go on in my head, and I won't feel so confused by all
this. :-)

Jefficus


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




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