0

I am working with Struts and TLDs.

I have a code something like this:

<html:select property="endAMPM" styleClass="inputField">
<html:option value=""></html:option>
<html:option value="AM" bundle="calendar" key="default.time.am"></html:option>
<html:option value="PM" bundle="calendar" key="default.time.pm"></html:option>
</html:select>

For English locale, it is rendering value properly, but for other non-English locale it was not rendering the default vaue as pre selected.

so, i have modified the code like this:

<bean:define id="am4"><bean:message bundle="calendar" key="default.time.am"/></bean:define>
                <bean:define id="pm4"><bean:message bundle="calendar" key="default.time.pm"/></bean:define>
                <html:select property="endAMPM" styleClass="inputField">
                    <html:option value=""></html:option>
                    <html:option value="<%=am4%>" bundle="calendar" key="default.time.am"></html:option>
                    <html:option value="<%=pm4%>" bundle="calendar" key="default.time.pm"></html:option>
                </html:select>

Now, it is redering the selected value properly. But, when i am submitting the form, it is not passing correct value to the ActionClass.

With AM and PM value it is working fine, but not rendering the selected value on UI.

From org.apache.struts.taglib.html :

if (this.selectTag().isMatched(this.value)) { results.append(" selected=\"selected\""); }

Is there any way of keeping the value as AM and PM and still render the selected value properly?

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
SubhenduGN
  • 21
  • 2
  • 14
  • Possible duplicate of [Parsing error for French locale with SimpleDateFormat(string,locale)](https://stackoverflow.com/questions/47467863/parsing-error-for-french-locale-with-simpledateformatstring-locale) – Aleksandr M Nov 24 '17 at 19:03
  • what does it meant actually – SubhenduGN Nov 27 '17 at 05:18
  • [check this](https://stackoverflow.com/questions/47467863/parsing-error-for-french-locale-with-simpledateformatstring-locale/47525022#47525022) – SubhenduGN Nov 28 '17 at 06:12

0 Answers0