How can I display option text on the drop down menu differently then selected text in a jsp using select2js


I have the following code snippet and I wanted to select multiple values from the drop-down at once(by ctrl key and mouse click) and also the selected text value(EXR) should be different from the option value(EXR - Exchange Value) in the drop down.

Suppose if drop down shows ${}+${dataset.description}(it will display EXR - Exchange Value ) then the selected text should show ${}(EXR). Currently it is showing${}+${dataset.description}for the dropdown and as well as selected value.

<td style="padding-left: 27px;">Select the interested text:<br>
  <select id="datasets" name="datasets" multiple="multiple" style="width: 189px;">
    <c:forEach var="entry" varStatus="status" items="${datasetMap}">
      <c:set var="dataset" value="${entry.value}" />
      <c:set var="selected" value="" />
      <c:forEach var="item" items="${selectedDataset}">
        <c:if test="${item eq}">
          <c:set var="selected" value="selected" />
      <option value="${},${},${dataset.description}" ${selected}>
        <c:out value="${}-${dataset.description}" />

I have tried to replace

     <option value="${},${},${dataset.description}" ${selected}>


      <option value="${}" ${selected}>

But it still showing the the name-description when I select some value from the drop-down list


Take a look at this part of the documentation: