RE: Easy EL question
you use .key or .value, e.g item.value['key'] item.key Allistair -Original Message- From: Guillaume Lederrey [mailto:[EMAIL PROTECTED] Sent: 08 August 2005 10:34 To: Tomcat Users List Subject: Easy EL question Hello ! I'm still having problem with all the different syntax used in JSP... so excuse my question if it sound really stupid ! I'm having to iterate on the values of a Map. So I'd like something like that : c:catch c:set var=items value=${itemsMap.values}/ /c:catch c:forEach items=${items} var=item [do something] /c:forEach Of course, it doesnt work because there is no getter in a Map to get the values ... There is probably a very easy and standard way to do exactly that ... could you help me on that one ? Thanks Guillaume - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- /FONT - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Easy EL question
Thanks for your answer ! But I'm afraid I dont really understand how to use it ... Do you mean I should iterate on the keys of my Map ? But then the question is of course How do I iterate on the keys ?. Maybe I should be more precise in my example, so here is my actual code (which doesnt work). dmaAssistantSession.deletedDmasSimple is a Map of beans (id, label). The key to the Map is the id of the bean itself (but I dont use the key here). c:catch c:set var=deletedDmas value=${dmaAssistantSession.deletedDmasSimple}/ /c:catch ul id=overviewDeletedDmas c:forEach items=${deletedDmas} var=deletedDma li html:link action=/DMAAssistant/ChooseDeletedDMAToCancelRemove paramId=id paramName=deletedDma paramProperty=id bean:message name=deletedDma property=label/ /html:link /li /c:forEach /ul Thanks a lot for the answer, but I would be even more thankfull if a bit more explanation goes with it ... On 8/8/05, Allistair Crossley [EMAIL PROTECTED] wrote: you use .key or .value, e.g item.value['key'] item.key Allistair -Original Message- From: Guillaume Lederrey [mailto:[EMAIL PROTECTED] Sent: 08 August 2005 10:34 To: Tomcat Users List Subject: Easy EL question Hello ! I'm still having problem with all the different syntax used in JSP... so excuse my question if it sound really stupid ! I'm having to iterate on the values of a Map. So I'd like something like that : c:catch c:set var=items value=${itemsMap.values}/ /c:catch c:forEach items=${items} var=item [do something] /c:forEach Of course, it doesnt work because there is no getter in a Map to get the values ... There is probably a very easy and standard way to do exactly that ... could you help me on that one ? Thanks Guillaume - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- /FONT - 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]
RE: Easy EL question
Hi, With what you supplied, the answer was the best you could have expected. The deletedDma item per loop iteration is of type MapEntry. This has getKey and getValue, hence why you can call deletedDma.key and deletedDma.value. In html your link would be a href=/DMAAssistant/ChooseDeletedDMAToCancelRemove?id=${deletedDma.value.id}Remove/a I am not sure if you can pass this into the html:link tag. Try ... // you don't need this block by the way c:catch c:set var=deletedDmas value=${dmaAssistantSession.deletedDmasSimple}/ /c:catch ul id=overviewDeletedDmas c:forEach items=${dmaAssistantSession.deletedDmasSimple} var=deletedDma li html:link action=/DMAAssistant/ChooseDeletedDMAToCancelRemove paramId=id paramName=deletedDma.value paramProperty=id bean:message name=deletedDma.value property=label / /html:link /li /c:forEach /ul -Original Message- From: Guillaume Lederrey [mailto:[EMAIL PROTECTED] Sent: 08 August 2005 12:10 To: Tomcat Users List Subject: Re: Easy EL question Thanks for your answer ! But I'm afraid I dont really understand how to use it ... Do you mean I should iterate on the keys of my Map ? But then the question is of course How do I iterate on the keys ?. Maybe I should be more precise in my example, so here is my actual code (which doesnt work). dmaAssistantSession.deletedDmasSimple is a Map of beans (id, label). The key to the Map is the id of the bean itself (but I dont use the key here). c:catch c:set var=deletedDmas value=${dmaAssistantSession.deletedDmasSimple}/ /c:catch ul id=overviewDeletedDmas c:forEach items=${deletedDmas} var=deletedDma li html:link action=/DMAAssistant/ChooseDeletedDMAToCancelRemove paramId=id paramName=deletedDma paramProperty=id bean:message name=deletedDma property=label/ /html:link /li /c:forEach /ul Thanks a lot for the answer, but I would be even more thankfull if a bit more explanation goes with it ... On 8/8/05, Allistair Crossley [EMAIL PROTECTED] wrote: you use .key or .value, e.g item.value['key'] item.key Allistair -Original Message- From: Guillaume Lederrey [mailto:[EMAIL PROTECTED] Sent: 08 August 2005 10:34 To: Tomcat Users List Subject: Easy EL question Hello ! I'm still having problem with all the different syntax used in JSP... so excuse my question if it sound really stupid ! I'm having to iterate on the values of a Map. So I'd like something like that : c:catch c:set var=items value=${itemsMap.values}/ /c:catch c:forEach items=${items} var=item [do something] /c:forEach Of course, it doesnt work because there is no getter in a Map to get the values ... There is probably a very easy and standard way to do exactly that ... could you help me on that one ? Thanks Guillaume - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE --- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- /FONT - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Easy EL question
On 8/8/05, Allistair Crossley [EMAIL PROTECTED] wrote: Hi, With what you supplied, the answer was the best you could have expected. The deletedDma item per loop iteration is of type MapEntry. This has getKey and getValue, hence why you can call deletedDma.key and deletedDma.value. Thanks a lot for the clarification (and for the short time between question and answer, amazing !). I know, my question was probably not clear enough, but ... I'm so uncomftable with JSP for the moment that I dont really know how to ask the questions ... I finally resolved it with : c:forEach items=${deletedDmas} var=deletedDma html:link action=/DMAAssistant/ChooseDeletedDMAToCancelRemove paramId=id paramName=deletedDma paramProperty=value.id bean:message name=deletedDma property=value.label/ /html:link /c:forEach It might be of some help if somebody has the same problem as me one of this day ... // you don't need this block by the way // I know, it just help type a bit less when reusing the var ... c:catch c:set var=deletedDmas value=${dmaAssistantSession.deletedDmasSimple}/ /c:catch Again, thanks a lot for your great help ! I think I'm slowly getting into JSP ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]