Ok...an example

In jsp

<c:forEach items="${someList}" var="myItem"
                   varStatus="counter">

<c:if test="${!empty someVar}">
        <somemarkup attr="$someVar}"/>
</c:if>
<someothermarkup/>

<c:set var="someVar" value="${myItem.myProperty}"/>

</c:forEach>

So in the above example I have a variable available called "someVar"
that is set to the value of the previous myItem's myProperty value. But
with T5 and the var binding I get THIS iterations value. The SCOPE of
the VAR binding is not wide enough for me. So is there an equivalent in
Tapestry or do I have to create a component and call it like this

<t:loop source="someList" value="myItem" index="counter">

<t:if test="someVar">
        <somemarkup attr="${someVar.value}"/>
</t:if>
<someothermarkup/>

<t:mypackage.set value="${myItem.myProperty}" t:id="someVar"/>


</t:loop>

And then have code like 

@Component(id="someVar")
Private MySetComponentType someVar;


And the MySetComponentType is just 

Public class MySetComponentType {
        @Parameter
        @Property
        Private String value;

}


But there just has to be a better way. Right?

Cheers for taking the time

Russell

-----Original Message-----
From: Kristian Marinkovic [mailto:[EMAIL PROTECTED] 
Sent: 06 October 2008 14:22
To: Tapestry users
Subject: Re: T5: equivelent of c:set ?

if you use the "var:" prefix in your template you do not need a
corresponding property in your page/component. and you 
can use this variable in your template multiple times (as in the
loop example). tapestry will generate a property on the fly
during rendering for this variable.

if you declare your components purley in your template
you can also pass in the parameters it accepts as well. 
.... and it should work with var: variables as well.

eg.
<ul>
    <li t:type="loop" source="1..10" value="var:index">
    <t:actionlink context="${var:index}">link</t:actionlink>
    </li>
</ul>

AFAIK you cannot access the value of the "var:" variables in your
pages or components.

hope this helps... maybe you can post an example... as posted by thiago

g,
kris




"Thiago H. de Paula Figueiredo" <[EMAIL PROTECTED]> 
06.10.2008 15:10
Bitte antworten an
"Tapestry users" <users@tapestry.apache.org>


An
"Tapestry users" <users@tapestry.apache.org>
Kopie

Thema
Re: T5: equivelent of c:set ?







Em Mon, 06 Oct 2008 09:01:48 -0300, Russell Brown
<[EMAIL PROTECTED]> 
 
escreveu:

> As far as I can see it is only of use in a loop in which case it is
set
> at the start of the iteration. How about iteration idioms that involve
> setting a value at the end of the iteration to be used by the next
> iteration? It is fairly common to see and trivial in struts, jsps,
> spring mvc etc, etc.

You can do that in Tapestry, but you just do it in a different way. 
Remember that the page class properties are always available to the 
template.

Please post a JSP example of what you're trying to accomplish so we'll
can 
 
help you better. ;)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
Consultor, desenvolvedor e instrutor em Java
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
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