Hi :) It seems I'm not very clear, sorry for my english...
As I answered to Chris, I'd like to display all the elements on the same page, but in different tables, that's why I can't tell my page before which element to render... Anyway, your explanation is very clear :) Thank you kristian.marinkovic wrote: > > i still do not understand what you want to do but i'll try to > provide some usful explanations :) > > if you have a list of elements you can render them using > a Loop component. The Loop component (see Component > Reference) provides the source parameter to pass in the > list (or another collection). The Loop component also > provides a value (Object) and an index (int) parameter. > > During the loop the variables referenced through the index and > value parameter will be updated with the current iteration count and > with the object via their setter methods. So if you also provide > getter methods for these variables you can access them in your > template. > > OGNL was used in T4 and provided means to access and return > an object from a list by directly providing an index in the template > or the .page file. This is not possible with T5s prop binding (eventually > will provide this functionality -> see JIRA). > > so if you know beforehand what object you need to can provide a > getter method for it > > g > kris > > > > Hibowl <[EMAIL PROTECTED]> > 02.10.2007 15:44 > Bitte antworten an > "Tapestry users" <users@tapestry.apache.org> > > > An > users@tapestry.apache.org > Kopie > > Thema > Re: [T5] Access table values from html > > > > > > > > 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#a12999029 > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- View this message in context: http://www.nabble.com/-T5--Access-table-values-from-html-tf4554333.html#a12999614 Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]