Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with dropdown list  RSS feed

Deepak Sahu
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a code for a dropdown list of 1-31.

<html:select styleId="fullTimingDay" property="fullTimingDay" size="1" >

<htmlption value="1">01</htmlption>

<htmlption value="2">02</htmlption>

<htmlption value="3">03</htmlption>

<htmlption value="4">04</htmlption>

<htmlption value="5">05</htmlption>

<htmlption value="6">06</htmlption>

<htmlption value="7">07</htmlption>

<htmlption value="8">08</htmlption>

<htmlption value="9">09</htmlption>

<htmlption value="10">10</htmlption>

<htmlption value="11">11</htmlption>

<htmlption value="12">12</htmlption>

<htmlption value="13">13</htmlption>

<htmlption value="14">14</htmlption>

<htmlption value="15">15</htmlption>

<htmlption value="16">16</htmlption>

<htmlption value="17">17</htmlption>

<htmlption value="18">18</htmlption>

<htmlption value="19">19</htmlption>

<htmlption value="20">20</htmlption>

<htmlption value="21">21</htmlption>

<htmlption value="22">22</htmlption>

<htmlption value="23">23</htmlption>

<htmlption value="24">24</htmlption>

<htmlption value="25">25</htmlption>

<htmlption value="26">26</htmlption>

<htmlption value="27">27</htmlption>

<htmlption value="28">28</htmlption>

<htmlption value="29">29</htmlption>

<htmlption value="30">30</htmlption>

<htmlption value="31">31</htmlption>


Instead of writing 31 times <html:select> </html:select>,please anyone provide solution to achieve this in a scalable way so that by writing less no of code we can achieve this.

Aniket S. Kulkarni
Ranch Hand
Posts: 87
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

<html:select styleId="fullTimingDay" property="fullTimingDay" size="1" >
<% for(int i=1;i<32;i++)
<option value="<%=i%>"><%=i%>  </option>
<% }

I hope this will help you.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!