开发者

Struts2 <s:select/> and a list of HashMap

I have a list of HashMap in my Action class, something like {month=05, day=20, dayOfWeek=Mon}. I need to pass it to a select tag from Struts2. Generated code from page looks like this:

<select name="dropdown" id="form_dropdown" onchange="fsubmit();">
  <option value="{month=07, day=11, dayOfWeek=MON}">{month=07, day=11, dayOfWeek=MON}</option开发者_Python百科>
  <option value="{month=07, day=12, dayOfWeek=TUE}">{month=07, day=12, dayOfWeek=TUE}</option>
  <option value="{month=07, day=13, dayOfWeek=WED}">{month=07, day=13, dayOfWeek=WED}</option>
</select>

Select tag from JSP:

<s:select headerKey="-1" list="liveHashDaysList" name="dropdown" value="" onchange="fsubmit();" />

I want to make the select to display data in this form "day / month dayOfWeek" but I can't get it to work. Any advice?


I made a Bean class, that handles all this objects.

Integer id;
String day;
String month;
String enDayWeek;
String frDayWeek;
String frDateFormatted;
String enDateFormatted;
String year;

Having Constructors with and without parameters, and the getters and setters methods.

Here we have some data fields, besides that I also have two fields with the date generated as a string, to display in frontend. When I receive response from select tag, I am iterating through the days list, and index the selected object, that was a solution at the moment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜