Yes, it's quite ridiculous :) But I needed to test...

My page should display all the objects (in fact the IDs) on the same page,
but on different tables :) !! 

I think the loop with if components could be a good idea !! But I thought
there was a way to display only one element of the list...(with an index
parameter maybe).

The help from the community is great :) I always search the mailing-list
before posting, and I have to say that it already help me a lot !!









Chris Lewis-5 wrote:
> 
> No, 15 getters would most likely be ridiculous. What I still don't know 
> is will this page be displaying all 15 at once (in different tables), or 
> will it display only 1 based on a choice made by the user?
> 
> If one, the separate your logic for extracting the selected one from the 
> list, possibly in an action handler or onActivate (if the selection is 
> made by a PageLink and context).
> If you are going to display more than one on the same page, then provide 
> that collection as a single List by a getter. Your template can then use 
> Loop (and conditional If components if needed) to display them.
> 
> Any clearer?
> 
> You are welcome for the help :-). T5 is great but still young and a bit 
> weak in documentation, so the community has to make up for that. I've 
> received much help from this list.
> 
> chris
> 
> Hibowl wrote:
>> Ok, in fact I want all the objects from the list, but not in the same
>> table,
>> that's why I dont think a Loop is usuable, because I won't display them
>> one
>> after the other.
>>
>> But even if I provide a getter for my object, I don't think I can tell my
>> page which object for the List to render (because it changes).
>>
>> Now, I have instanciated all the 15 Objects of the list, and I provide 15
>> getters... But I don't think it's very optimal !!
>>
>> Thanks a lot for your help Chris !!
>>
>>
>>
>>
>>
>>
>>
>> Chris Lewis-5 wrote:
>>   
>>> Ok, but _how_ do you want to get this object? It seems like you only 
>>> want one of them from the List, so you won't need to Loop. If that's 
>>> right then you need only to provide a getter for your object (this 
>>> assumes your page knows which specific object is desired).
>>>
>>> Hibowl wrote:
>>>     
>>>> I'm maybe not very clear, I will try to describe better.
>>>> I have an ArrayList from Fichier, and I'd like to display their IDs.
>>>>
>>>> Start.java :
>>>>
>>>> private ArrayList<Fichier> _listeFichiers;
>>>> private Fichier _fichier;
>>>>
>>>> //+getters/setters
>>>>
>>>> Fichier.java : 
>>>> private fichierId;
>>>> ...
>>>> //+getters/setters
>>>>
>>>>
>>>>
>>>> Start.html : I have several tables with Fichier descriptions, and there
>>>> is a
>>>> cell where I want to display the Id of the Fichier :
>>>>
>>>>  <table id="tbFichiers" summary="Fichiers">
>>>>   
>>>>    <tr>
>>>>        <th id="th1" class="colonnefichiers"> # Numéro Ordre </th>
>>>>        <th id="th2">
>>>>           # Description  
>>>>        </th>
>>>>        <th id="th3" class="colonneavancement">Avancement</th>
>>>>        <th id="th4" class="colonnenotifications">Etat </th>
>>>>     </tr>
>>>>      <tr>
>>>>       <td class="tdlft" headers="th1"><t:pagelink page="fichiers/detail"
>>>> context=${fichier.id} onmouseover="return overlib('Afficher détails
>>>> fichier
>>>> 50.');" onmouseout="return nd();"><strong>Fichier
>>>> 50</strong></t:pagelink>
>>>> javascript:void(0); ? </td>
>>>>       <td class="tdlft" headers="th2">alerte</td>
>>>>       <td headers="th3"><strong>Fichier Id : ${fichier.id}</strong></td>
>>>>       <td headers="th4"><strong>Etat </strong></td>
>>>>     </tr>
>>>>     .......
>>>>    </table>
>>>>
>>>>
>>>> My problem is how to display the Id of the fichier, I would like to
>>>> specify
>>>> the index in the array, so that it could render the good id.
>>>>
>>>> Am I clear enough ?
>>>>
>>>> thanks :)
>>>>
>>>>
>>>>
>>>>
>>>> Chris Lewis-5 wrote:
>>>>   
>>>>       
>>>>> I'm sorry I'm afraid I don't understand your situation. If you could 
>>>>> explain what exactly you are trying to do, maybe I can help.
>>>>>
>>>>> chris
>>>>>
>>>>> Hibowl wrote:
>>>>>     
>>>>>         
>>>>>> Hi, 
>>>>>> thanks for your answer. I tried with the loop, but I need to display
>>>>>> only
>>>>>> one value. I think I could use the index parameter for Loop, but I
>>>>>> don't
>>>>>> see
>>>>>> how to link it with my List.
>>>>>>
>>>>>> http://www.nabble.com/T5%3A-How-to-acces-to-an-array-from-loop--tf3599642.html#a10054876
>>>>>> Here is an example, but how can I use it with my example ?
>>>>>>
>>>>>> Thank you for your help !
>>>>>>
>>>>>>
>>>>>> Chris Lewis-5 wrote:
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> This is a pretty basic operation that you can learn by doing the T5 
>>>>>>> tutorial.
>>>>>>> It sounds like you want to enumerate a list and display something
>>>>>>> for 
>>>>>>> each iteration - a String property from each Fichier instance. To do 
>>>>>>> this you need the T5 Loop 
>>>>>>> <http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html#orgapachetapestrycorelibcomponentsloop>
>>>>>>>  
>>>>>>> component. Your page provides the List (any Iterable), but must also 
>>>>>>> provide a property for holding a member of the List for each
>>>>>>> iteration 
>>>>>>> (the value parameter of the Loop). So in your page you need:
>>>>>>>
>>>>>>> //The Iterable.
>>>>>>> private ArrayList<Fichier> listeFichiers;
>>>>>>>
>>>>>>> //The "current" element.
>>>>>>> private Fichier fichier;
>>>>>>>
>>>>>>> //now you need at least a getter for your list, and both a getter
>>>>>>> and
>>>>>>> a 
>>>>>>> setter for fichier.
>>>>>>>
>>>>>>> In your template you can now:
>>>>>>>
>>>>>>> <t:loop source="listeFichiers" value="fichier">
>>>>>>>     ${fichier.field}
>>>>>>> </t:loop>
>>>>>>>
>>>>>>> Note that ${fichier.field} will result in a call to the method 
>>>>>>> Fichier#getField.
>>>>>>>
>>>>>>> Hibowl wrote:
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'd like to access the values of a List from my html page, but I
>>>>>>>> don't
>>>>>>>> know
>>>>>>>> how to do that...
>>>>>>>>
>>>>>>>> Start.java :
>>>>>>>>
>>>>>>>> private ArrayList<Fichier> listeFichiers;
>>>>>>>>
>>>>>>>> (getter/setter).
>>>>>>>>
>>>>>>>>
>>>>>>>> Start.html :
>>>>>>>> I want to display a field from Fichier (type String). But how can I
>>>>>>>> access
>>>>>>>> to it ? Is there a way to use such a ${listeFichiers...} with a
>>>>>>>> parameter
>>>>>>>> ?
>>>>>>>>
>>>>>>>> Thank you for any help !
>>>>>>>>
>>>>>>>>
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>               
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>     
>>>>>         
>>>>   
>>>>       
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-T5--Access-table-values-from-html-tf4554333.html#a12999402
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to