"Forwarding" attributes in layouts

View: New views
2 Messages — Rating Filter:   Alert me  

"Forwarding" attributes in layouts

by Roland Bali :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm trying to standardize my UI by using layouts as much as possible.
This include using "sub-layouts" (layouts calling outher layouts). What
I would like to do is "forward" some attributes to the sublayout, is
this possible? Or do I have to include every possible attribute that can
be sent to, for example, stripes:text?

Example, I would like the attribute foo to be "forwarded" to the
text.jsp-layout:

mypage.jsp:
<stripes:layout-render name="fieldItem.jsp" property="${property}"
type="text" foo="bar" />

fieldItem.jsp:
<stripes:layout-definition>
        <c:if test="${type == 'text'}">
        <stripes:layout-render name="text.jsp" property="${property}" />
        </c:if>
</stripes:layout-definition>

text.jsp:
<stripes:layout-definition>
        <stripes:text name="${property}" foo="${foo}"/>
</stripes:layout-definition>


Kind regards,
Roland


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users

Re: "Forwarding" attributes in layouts

by Oscar Westra van Holthe - Kind :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 26-06-2008 at 08:52, Roland Bali wrote:
> Hi,
>
> I'm trying to standardize my UI by using layouts as much as possible.
> This include using "sub-layouts" (layouts calling outher layouts). What
> I would like to do is "forward" some attributes to the sublayout, is
> this possible? Or do I have to include every possible attribute that can
> be sent to, for example, stripes:text?

My understanding from the documentation [1] ("Layouts within layouts") is
that you must specify everything that you pass on. I'm not sure however, if
this is still the case for the "dynattr" tag library (this variant allows
dynamic attributes).

In your example however, this is not really needed (IMNSHO): by making all
parameters explicit, you prevent unintended reuse of names.

[1] http://www.stripesframework.org/display/stripes/Layout+Reuse


Oscar

--
   ,-_   Envy plus rhetoric equals "social justice".
  /() )
 (__ (    -- Thomas Sowell
=/  ()

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-users mailing list
Stripes-users@...
https://lists.sourceforge.net/lists/listinfo/stripes-users
LightInTheBox - Buy quality products at wholesale price