0

I have the following data:

records{doc_Title="title",doc_Title_en="en",doc_Title_es="es",doc_Title_fr="fr"...}

Also, in my jsp, I have the language value in my lang variable which varies from page to page. Depending on the lang value, the corresponding doc_Title has to be displayed. Is this achievable using EL?

${record.docTitle} can be directly accessed which would display the value. but I want the lang value to be dynamically changed while accessing the value from the records.

For example: lang="en";

<c:set var="docName" value="record.docTitle_${lang}" />

But, ${docName} displays "record_docTitle_en" and not "en" (the value). How is this achievable?

Ravi K Thapliyal
  • 51,095
  • 9
  • 76
  • 89

1 Answers1

1

Obtained the answer for this from JSTL - how to get a value of value? and thus the code went like this:

    <c:set var="docname" value="docName_${lang}" />
    ${record[docname]} 
Community
  • 1
  • 1