You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ka...@telenet.be on 2006/08/11 12:02:15 UTC

bean-el:write use case

The documentation says you don't need bean-el:write because of c:out,
but I think I have a valid use case for bean-el:write (Assuming
you want to avoid using <% %>).

Example:
I have a list of objects named "results"
each result contains a hashmap called 'translations'.

(1) render the results in a particular language (e.g. german)

<c:forEach items="results" var="result">
    <c:out value="${result.translations.de}"/>
</c:forEach>

(2) render the results in ${language} (= "language" in the pageContext)?

<c:out value="${result.translations(${language})}"/> is of course invalid, but
I think we could do it with bean-el:write

(...)
<bean-el:write name="result" property="translations(${language})"/>

What do you think?  Is there a way to do this without (the non-existant) bean-el:write that I overlooked?

Karel

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: bean-el:write use case

Posted by vijay venkataraman <vi...@ltp.soft.net>.
See response inline.

karel.vervaeke@telenet.be wrote:

>The documentation says you don't need bean-el:write because of c:out,
>but I think I have a valid use case for bean-el:write (Assuming
>you want to avoid using <% %>).
>
>Example:
>I have a list of objects named "results"
>each result contains a hashmap called 'translations'.
>
>(1) render the results in a particular language (e.g. german)
>
><c:forEach items="results" var="result">
>    <c:out value="${result.translations.de}"/>
></c:forEach>
>
>(2) render the results in ${language} (= "language" in the pageContext)?
>
><c:out value="${result.translations(${language})}"/> is of course invalid, but
>I think we could do it with bean-el:write
>
>(...)
><bean-el:write name="result" property="translations(${language})"/>
>  
>
pageContext - Is implicit variable in jsp.

<c:out value="${result.translations[pageContext.language]}"/>


>What do you think?  Is there a way to do this without (the non-existant) bean-el:write that I overlooked?
>
>Karel
>
>  
>
Thanks,
Vijay Venkataraman

------------------------------DISCLAIMER------------------------------
This message is for the named person's use only. It may contain 
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission. 

If you receive this message in error, please immediately delete it and 
all copies of it from your system, destroy any hard copies of it and 
notify the sender. You must not, directly or indirectly, use, disclose, 
distribute, print, or copy any part of this message if you are not the 
intended recipient. 

Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each 
reserve the right to monitor all e-mail communications through its 
networks. 

Any views expressed in this message are those of the 
individual sender, except where the message states otherwise and the 
sender is authorized to state them to be the views of any such entity.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org