Announcement Announcement Module
Collapse
No announcement yet.
problem view in a jsp page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem view in a jsp page

    Hi,

    I have a problem with the common taglib.
    You'll found here my jsp code.
    I store my java collection object itemList in item. I store the language of my session in a java variable and i would like use this variable like the parameter in my EL.

    <c:forEach var="item" items="${itemList}" varStatus="status">
    <tr bgcolor="#FFFF88">
    <td>
    <b>
    <a href="<c:url value="/editCodeTraduction.do"><caram name="codeId" value="${item.id}"/></c:url>">
    <c:out value="${item.id}"/>
    </a>
    </b>
    </td>

    <td>
    <c:out value="${item.code}"/>
    </td>


    <%-- here I get the language in a java variable--%>
    <%
    String sLangue = request.getLocale().getLanguage();
    %>


    <td> <%=sLangue%> </td>
    <td>

    <%-- And here, via the Expression Language, I would like get the traduction of the code via the language. I get the language in a java variable and I would like use this java variable like a parameter of my function traductions. Can you help me for the synthax expression between Expression Language and java --%>

    <c:out value="${item.traductions[\'"+<%=sLangue%>+"\'].traduction}" /> </td>

    </tr>

    </c:forEach>

  • #2
    Instead of this:
    Code:
     <%
    String sLangue = request.getLocale&#40;&#41;.getLanguage&#40;&#41;;
    %>
    do this:

    Code:
    <c&#58;set var="sLanguage"><%= request.getLocale&#40;&#41;.getLanguage&#40;&#41; %></c&#58;set>
    then your cout will look like:
    Code:
    <c&#58;out value="$&#123;item.traductions&#91;sLanguage&#93;.traduction&#125;" />

    HTH

    Comment

    Working...
    X