You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Nathan Bubna <na...@esha.com> on 2003/07/23 21:10:13 UTC

TilesTool discussion

ok, the tool looks really good so far.  i do have a quick question:

why the getAsString(String name) method?  is there a particular reason to have
these component context attributes returned as Strings?  why not just have the
method be:

public Object get(String name) {
    return ComponentContext.getContext(request).getAttribute(name);
}

or at least

public String get(String name) {
    return (String)ComponentContext.getContext(request).getAttribute(name);
}

then you could use it as $tiles.attr_name instead of
$tiles.getAsString("attr_name")

it seems easier and more Velocity-ish like this to me, but being a Tiles
newbie, maybe i'm missing something...

or if getting these tiles attributes as Strings is a less common behavior,
maybe we'd want to switch from $tiles.insert("menu") to $tiles.menu  and then
have $tiles.getAsString("attr_name") switched to $tiles.getAttr("attr_name")
or $tiles.getString("attr_name").

anyway, i'm just trying to KISS.  what do you guys think?

Nathan Bubna
nathan@esha.com


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


RE: TilesTool discussion

Posted by "Marinó A. Jónsson" <ma...@centrum.is>.
great!

always nice to leave a mark :P

cheers,
Marino

-----Original Message-----
From: Nathan Bubna [mailto:nathan@esha.com] 
Sent: 24. júlí 2003 01:26
To: Velocity Developers List
Subject: Re: TilesTool discussion

Marinó A. Jónsson said:
...
> There seem to be two main tags in the the Tiles taglib - namely
> <tiles:insert attribute="value"> and <tiles:getAsString name="value"> (the
> insert tag can take many more params).
>
> For more information, see:
>
http://jakarta.apache.org/struts/api/org/apache/struts/tiles/package-summary
> .html (check out the description below the package overview)

ah, i hadn't noticed that.  looks like good stuff.  thanks!

> I've never used Tiles with JSP myself ... my original intent was to mimick
> these two tags in the TilesTool using java methods for each tag
> respectively.  I don't use the getAsString(String name) method myself and
> haven't given it much thought - just threw it in there for completeness :)
>
> I don't know ... maybe I thought it would be more intuitive for those who
> are already familiar with Tiles and the Tiles taglib to use methods with
> these names ... more consistent.

yeah, back in the early days of VelocityStruts, we debated this and decided
that we're not writing this just to mimic JSP tags.  we're using velocity
because it's a superior paradigm.  :) so, we should be able to do things
better than tags do, not just mimic them!

> If we are going to stray from these names (in the name of Velocity-ishness
> and KISS) I would have to go with:
>
> insert(Object attr) -> get(String attr)
>
> and
>
> getAsString(String name) -> getString(String name)

+1

the more i look at tiles and your example, the more i think this is the best
way.  and ya gotta love that $tiles.menu is *so* much cleaner and easier
than

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert attribute="menu" />

:)

> since getting the tiles attributes as Strings is obviously less common.
> That would make inserts sort of "default" :)
>
> I would be ok with that personally.

cool.  well, i'm thinking that with that change and a few style nits, the
TilesTool is about ready to go.  i think i'll go ahead and check it in
shortly, but i'd still like to hear what Tim (or anyone else) thinks too.

oh, and thanks again for the example.  hopefully we'll be able to work the
TilesTool (and other new features) into a nice, new example app before we do
a
1.1 release.

Nathan Bubna
nathan@esha.com


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




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


Re: TilesTool discussion

Posted by Nathan Bubna <na...@esha.com>.
Marinó A. Jónsson said:
...
> There seem to be two main tags in the the Tiles taglib - namely
> <tiles:insert attribute="value"> and <tiles:getAsString name="value"> (the
> insert tag can take many more params).
>
> For more information, see:
> http://jakarta.apache.org/struts/api/org/apache/struts/tiles/package-summary
> .html (check out the description below the package overview)

ah, i hadn't noticed that.  looks like good stuff.  thanks!

> I've never used Tiles with JSP myself ... my original intent was to mimick
> these two tags in the TilesTool using java methods for each tag
> respectively.  I don't use the getAsString(String name) method myself and
> haven't given it much thought - just threw it in there for completeness :)
>
> I don't know ... maybe I thought it would be more intuitive for those who
> are already familiar with Tiles and the Tiles taglib to use methods with
> these names ... more consistent.

yeah, back in the early days of VelocityStruts, we debated this and decided
that we're not writing this just to mimic JSP tags.  we're using velocity
because it's a superior paradigm.  :) so, we should be able to do things
better than tags do, not just mimic them!

> If we are going to stray from these names (in the name of Velocity-ishness
> and KISS) I would have to go with:
>
> insert(Object attr) -> get(String attr)
>
> and
>
> getAsString(String name) -> getString(String name)

+1

the more i look at tiles and your example, the more i think this is the best
way.  and ya gotta love that $tiles.menu is *so* much cleaner and easier than

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert attribute="menu" />

:)

> since getting the tiles attributes as Strings is obviously less common.
> That would make inserts sort of "default" :)
>
> I would be ok with that personally.

cool.  well, i'm thinking that with that change and a few style nits, the
TilesTool is about ready to go.  i think i'll go ahead and check it in
shortly, but i'd still like to hear what Tim (or anyone else) thinks too.

oh, and thanks again for the example.  hopefully we'll be able to work the
TilesTool (and other new features) into a nice, new example app before we do a
1.1 release.

Nathan Bubna
nathan@esha.com


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


RE: TilesTool discussion

Posted by "Marinó A. Jónsson" <ma...@centrum.is>.
Very good points Nathan.

There seem to be two main tags in the the Tiles taglib - namely
<tiles:insert attribute="value"> and <tiles:getAsString name="value"> (the
insert tag can take many more params).

For more information, see:
http://jakarta.apache.org/struts/api/org/apache/struts/tiles/package-summary
.html (check out the description below the package overview)

I've never used Tiles with JSP myself ... my original intent was to mimick
these two tags in the TilesTool using java methods for each tag
respectively.  I don't use the getAsString(String name) method myself and
haven't given it much thought - just threw it in there for completeness :)

I don't know ... maybe I thought it would be more intuitive for those who
are already familiar with Tiles and the Tiles taglib to use methods with
these names ... more consistent.

If we are going to stray from these names (in the name of Velocity-ishness
and KISS) I would have to go with:


insert(Object attr) -> get(String attr)

and

getAsString(String name) -> getString(String name)


since getting the tiles attributes as Strings is obviously less common.
That would make inserts sort of "default" :)

I would be ok with that personally.

cheers,
Marino

-----Original Message-----
From: Nathan Bubna [mailto:nathan@esha.com] 
Sent: 23. júlí 2003 19:10
To: velocity-dev@jakarta.apache.org
Subject: TilesTool discussion

ok, the tool looks really good so far.  i do have a quick question:

why the getAsString(String name) method?  is there a particular reason to
have
these component context attributes returned as Strings?  why not just have
the
method be:

public Object get(String name) {
    return ComponentContext.getContext(request).getAttribute(name);
}

or at least

public String get(String name) {
    return (String)ComponentContext.getContext(request).getAttribute(name);
}

then you could use it as $tiles.attr_name instead of
$tiles.getAsString("attr_name")

it seems easier and more Velocity-ish like this to me, but being a Tiles
newbie, maybe i'm missing something...

or if getting these tiles attributes as Strings is a less common behavior,
maybe we'd want to switch from $tiles.insert("menu") to $tiles.menu  and
then
have $tiles.getAsString("attr_name") switched to $tiles.getAttr("attr_name")
or $tiles.getString("attr_name").

anyway, i'm just trying to KISS.  what do you guys think?

Nathan Bubna
nathan@esha.com


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




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