Hi Martin.

I must admit that I have not thought about it at all, but
I'll try here to come up with something, and to tell you
how I use tiles.

I usually end up with a moderate long struts.xml a *very long*
tiles.xml (maybe that's not the best way to use tiles, but
it's the way I use it. Antonio, please add here if you wish..).

I use tiles in a way that I have all tiles predefined in
tiles.xml and all final page composition in a couple of
files (the template files). The template files have *all* the
<tiles:insertAttribute .../> tags, as this:
<tiles:insertAttribute name="header"/>
and all the other tiles never use insertAttribute again.

So, how could the convention plugin help with tiles?
I'd rather not use annotations at all for results mapping.

I don't know if it is already that way, but I believe that
instead of having to add annotations to override behaviour
the convention plugin should consider struts.xml and tiles.xml
If the above files have not a definition for the current request,
then use the convention, otherwise use that definition to
ovverride the behaviour.

Maybe the convention plugin should look into the tiles.xml
file, or check to see if the tiles plugin or tiles listener
are in the game..
Most probably, the definition names in tiles.xml should
follow the conventions, so that
<definition name="auctionView"..
becomes
<definition name="auction"
and
<definition name="auctionInput"..
becomes
<definition name="auction-input"
etc..

so that:
URL: /auction
translates to:
Action class: rootpkg.Auction
tile definition: auction (or auction-input if the result is input)

in order to optimise for applications that don't use tiles,
you could have a property in struts.properties that tells
the convention plugin to consider tiles or not, while
trying to determine the view for the request
so that if tiles should be considered,
in the order try: tiles, jsp, velocity, etc..

I hope this helps.
Best regards.
Robi


here's a little part of my tiles.xml

<definition name="mainLayout" template="/WEB-INF/tiles/layouts/classicLayout.jsp">
  <put-attribute name="title" value="myecommerce homepage" />
  <put-attribute name="header" value="/WEB-INF/tiles/header.jsp" />
  <put-attribute name="other" value="/WEB-INF/tiles/other.jsp" />
  <put-attribute name="categories" value="/WEB-INF/tiles/categories.jsp" />
  <put-attribute name="userMenu" value="/WEB-INF/tiles/userMenu.jsp" />
  <put-attribute name="messages" value="/WEB-INF/tiles/messages.jsp" />
  <put-attribute name="body" value="/WEB-INF/tiles/default_body.jsp" />
  <put-attribute name="siteOwner" value="/WEB-INF/tiles/siteOwner.jsp" />
  <put-attribute name="banners" value="/WEB-INF/tiles/banners.jsp" />
  <put-attribute name="footer" value="/WEB-INF/tiles/footer.jsp" />
</definition>

<definition name="home" extends="mainLayout" template="/WEB-INF/tiles/layouts/classicLayoutHome.jsp">
  <put-attribute name="title" value="myecommerce home page" />
  <put-attribute name="body" value="/WEB-INF/tiles/content/home.jsp" />
</definition>

<definition name="help" extends="home">
  <put-attribute name="title" value="myecommerce help page" />
  <put-attribute name="body" value="/WEB-INF/tiles/content/help.jsp" />
</definition>

<definition name="about" extends="home">
  <put-attribute name="title" value="myecommerce about page" />
  <put-attribute name="body" value="/WEB-INF/tiles/content/about.jsp" />
</definition>

<definition name="auctionView" extends="mainLayout">
  <put-attribute name="title" value="View Auction" />
<put-attribute name="body" value="/WEB-INF/tiles/content/auctionView.jsp" />
</definition>


Martin wrote:
Roberto-

Just to clarify..how should the Results mapping annotations configuration be introduced?

Thanks
Martin--
----- Original Message ----- From: "Roberto Nunnari" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Saturday, June 21, 2008 7:25 PM
Subject: Re: validation and action names with slashes


Jeromy Evans wrote:
Roberto Nunnari wrote:
Hi Jeromy!

The Convention plugin looks very interesting! Does it work
with 2.1.3-SNAPSHOT ? I'd like to give it a try this weekend.

What about mixing it with tiles?
Would it require specifying tiles results thus breaking
the convenience of conventions?

It works with 2.1.3-SNAPSHOT but isn't distributed with it as it's still in the sandbox.

WOW.. The convention plugin rocks! I like it!
I'm writing action classes and related jsps and struts finds the
right Action class and jsp without having to touch the struts.xml
I don't even have the struts.xml file!

This is a very confortable way of writing web applications.


It works with Tiles, but you have to explicitly declare each @Result(type=TilesResult.class,value="xxx") which I find really annoying (as you say, it breaks the convenience of the convention). I've been intending to raise that over at struts-dev, which I'll do now.

Yes.. Please do. If it would support tiles, I'd start using
it right away, but like this, no way.

I don't like the idea of having to define result mappings in java
source code.. and to say it all.. I don't like annotations,
although I admit that at times annotations are very useful. :-)


Best regards.
Robi

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to