You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ashish Mishra <am...@webifyservices.com> on 2003/08/20 10:39:41 UTC

Converting Code from Struts to Tapestry...

Hi all,

I have the following code in struts-velocity

#set($x=0)

#foreach($portlet in $portletlist)

<tr>

#if($x%2==0)

<td>$portlet</td>

#else

<td>$portlet</td>

#end

</tr>

#set($x=$x+1)

#end



I need to convert it into Tapestry.Can anyone provide me with the code related to getting the index value and using it to my requirements.



Regards

Ashish



Re: Converting Code from Struts to Tapestry...

Posted by Ashish Mishra <am...@webifyservices.com>.
Hi all,

I want to display odd values in one column and even values in other column.

$portlets contain the List containing the String object i.e. directly the
data.

Regards

Ashish
----- Original Message -----
From: "Mindbridge" <mi...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>; "Ashish Mishra"
<am...@webifyservices.com>
Sent: Wednesday, August 20, 2003 5:24 PM
Subject: Re: Converting Code from Struts to Tapestry...


> Hi,
>
> What you sent is roughly equivalent to:
>
> <span jwcid="foreach@Foreach" source="ognl:portletlist">
>     <tr>
>         <td><span jwcid="@Insert"
> value="ognl:components.foreach.value"/></td>
>     </tr>
> </span>
>
> You would need to have getPortletlist() in your Java bean.
>
> The index can be accessed by doing 'components.foreach.index' or by making
a
> property in Java bean and binding Foreach's index parameter to that
property
> (<span jwcid="foreach@Foreach" source="ognl:portletlist"
> index="ognl:index">).
>
>
> What exactly do you want to achieve? Position the items in the list in two
> columns? And what are the portlets? Strings, other objects, HTML, other
> stuff?
>
> Best regards,
> -mb
>
>
>
> ----- Original Message -----
> From: "Ashish Mishra" <am...@webifyservices.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, August 20, 2003 11:39 AM
> Subject: Converting Code from Struts to Tapestry...
>
>
> Hi all,
>
> I have the following code in struts-velocity
>
> #set($x=0)
>
> #foreach($portlet in $portletlist)
>
> <tr>
>
> #if($x%2==0)
>
> <td>$portlet</td>
>
> #else
>
> <td>$portlet</td>
>
> #end
>
> </tr>
>
> #set($x=$x+1)
>
> #end
>
>
>
> I need to convert it into Tapestry.Can anyone provide me with the code
> related to getting the index value and using it to my requirements.
>
>
>
> Regards
>
> Ashish
>
>
>


Re: Converting Code from Struts to Tapestry...

Posted by "Julio C. Rivera" <ju...@ya.com>.
That is the naming convention for implicits components (components in the 
template and not declared in the specification)
    componentId@componentType
componentId is useful for referencing the component later (like in the 
Mindbridge example). If you don't need a componentId, you can write 
@componentType (an anonymous component).

Regards.
    Julio.

At 18:20 20/08/2003 +0530, you wrote:
>Hi MB,
>That was very fine.
>I am using Tapestry 3.0 beta1 where I have not seen foreach@Foreach.
>Whats all this foreach@Foreach ?
>Amol
>----- Original Message -----
>From: "Mindbridge" <mi...@yahoo.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>; "Ashish Mishra"
><am...@webifyservices.com>
>Sent: Wednesday, August 20, 2003 5:24 PM
>Subject: Re: Converting Code from Struts to Tapestry...
>
>
> > Hi,
> >
> > What you sent is roughly equivalent to:
> >
> > <span jwcid="foreach@Foreach" source="ognl:portletlist">
> >     <tr>
> >         <td><span jwcid="@Insert"
> > value="ognl:components.foreach.value"/></td>
> >     </tr>
> > </span>
> >
> > You would need to have getPortletlist() in your Java bean.
> >
> > The index can be accessed by doing 'components.foreach.index' or by making
>a
> > property in Java bean and binding Foreach's index parameter to that
>property
> > (<span jwcid="foreach@Foreach" source="ognl:portletlist"
> > index="ognl:index">).
> >
> >
> > What exactly do you want to achieve? Position the items in the list in two
> > columns? And what are the portlets? Strings, other objects, HTML, other
> > stuff?
> >
> > Best regards,
> > -mb
> >
> >
> >
> > ----- Original Message -----
> > From: "Ashish Mishra" <am...@webifyservices.com>
> > To: "Tapestry users" <ta...@jakarta.apache.org>
> > Sent: Wednesday, August 20, 2003 11:39 AM
> > Subject: Converting Code from Struts to Tapestry...
> >
> >
> > Hi all,
> >
> > I have the following code in struts-velocity
> >
> > #set($x=0)
> >
> > #foreach($portlet in $portletlist)
> >
> > <tr>
> >
> > #if($x%2==0)
> >
> > <td>$portlet</td>
> >
> > #else
> >
> > <td>$portlet</td>
> >
> > #end
> >
> > </tr>
> >
> > #set($x=$x+1)
> >
> > #end
> >
> >
> >
> > I need to convert it into Tapestry.Can anyone provide me with the code
> > related to getting the index value and using it to my requirements.
> >
> >
> >
> > Regards
> >
> > Ashish
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Converting Code from Struts to Tapestry...

Posted by Amol Yadwadkar <ay...@webifyservices.com>.
Hi MB,
That was very fine.
I am using Tapestry 3.0 beta1 where I have not seen foreach@Foreach.
Whats all this foreach@Foreach ?
Amol
----- Original Message -----
From: "Mindbridge" <mi...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>; "Ashish Mishra"
<am...@webifyservices.com>
Sent: Wednesday, August 20, 2003 5:24 PM
Subject: Re: Converting Code from Struts to Tapestry...


> Hi,
>
> What you sent is roughly equivalent to:
>
> <span jwcid="foreach@Foreach" source="ognl:portletlist">
>     <tr>
>         <td><span jwcid="@Insert"
> value="ognl:components.foreach.value"/></td>
>     </tr>
> </span>
>
> You would need to have getPortletlist() in your Java bean.
>
> The index can be accessed by doing 'components.foreach.index' or by making
a
> property in Java bean and binding Foreach's index parameter to that
property
> (<span jwcid="foreach@Foreach" source="ognl:portletlist"
> index="ognl:index">).
>
>
> What exactly do you want to achieve? Position the items in the list in two
> columns? And what are the portlets? Strings, other objects, HTML, other
> stuff?
>
> Best regards,
> -mb
>
>
>
> ----- Original Message -----
> From: "Ashish Mishra" <am...@webifyservices.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, August 20, 2003 11:39 AM
> Subject: Converting Code from Struts to Tapestry...
>
>
> Hi all,
>
> I have the following code in struts-velocity
>
> #set($x=0)
>
> #foreach($portlet in $portletlist)
>
> <tr>
>
> #if($x%2==0)
>
> <td>$portlet</td>
>
> #else
>
> <td>$portlet</td>
>
> #end
>
> </tr>
>
> #set($x=$x+1)
>
> #end
>
>
>
> I need to convert it into Tapestry.Can anyone provide me with the code
> related to getting the index value and using it to my requirements.
>
>
>
> Regards
>
> Ashish
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Re: Converting Code from Struts to Tapestry...

Posted by Mindbridge <mi...@yahoo.com>.
Hi,

What you sent is roughly equivalent to:

<span jwcid="foreach@Foreach" source="ognl:portletlist">
    <tr>
        <td><span jwcid="@Insert"
value="ognl:components.foreach.value"/></td>
    </tr>
</span>

You would need to have getPortletlist() in your Java bean.

The index can be accessed by doing 'components.foreach.index' or by making a
property in Java bean and binding Foreach's index parameter to that property
(<span jwcid="foreach@Foreach" source="ognl:portletlist"
index="ognl:index">).


What exactly do you want to achieve? Position the items in the list in two
columns? And what are the portlets? Strings, other objects, HTML, other
stuff?

Best regards,
-mb



----- Original Message ----- 
From: "Ashish Mishra" <am...@webifyservices.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, August 20, 2003 11:39 AM
Subject: Converting Code from Struts to Tapestry...


Hi all,

I have the following code in struts-velocity

#set($x=0)

#foreach($portlet in $portletlist)

<tr>

#if($x%2==0)

<td>$portlet</td>

#else

<td>$portlet</td>

#end

</tr>

#set($x=$x+1)

#end



I need to convert it into Tapestry.Can anyone provide me with the code
related to getting the index value and using it to my requirements.



Regards

Ashish