You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by dirk <st...@pandora.be> on 2003/12/19 13:50:53 UTC

simple question

I want to create a select box with the values 1 thru 100 how can i do that? What i have is:
But that is not working. Any idea ?
Thanks !
<html:select property="selectBox" styleClass="content">

<% for(int i=0;i<999;i++){ %>

<html:option value="<%=i%>"><%=i%></html:option>

<%}%>

</html:select> 

Re: simple question

Posted by Mark Lowe <ma...@talk21.com>.
Agreed.


On 19 Dec 2003, at 14:02, Kris Schneider wrote:

> I know the question is targeted at doing this in a JSP, but why 
> wouldn't you
> just set up a String[100] in application scope, name it "numbers" (or 
> whatever)
> and do something like:
>
> <html:select property="selectBox" styleClass="content">
>   <html:options name="numbers"/>
> </html:select>
>
> Quoting Mark Lowe <ma...@talk21.com>:
>
>> Nothing to add really just a few variations on a theme.
>>
>> <c:forEach var="num" begin="0" end="999">
>> 	<html-el:option value=${num}">
>> 		<c:out value="${num}" />
>> 	</html-el:option>
>> </c:forEach>
>>
>> i think
>>
>> <c:forEach var="num" begin="0" end="999">
>> 	<htmll:option value=<%= num %>"><%= num %>" /></html:option>
>> </c:forEach>
>>
>> will also work although perhaps you need to convert the int to a 
>> string.
>>
>>
>>
>> On 19 Dec 2003, at 12:50, dirk wrote:
>>
>>> I want to create a select box with the values 1 thru 100 how can i do
>>> that? What i have is:
>>> But that is not working. Any idea ?
>>> Thanks !
>>> <html:select property="selectBox" styleClass="content">
>>>
>>> <% for(int i=0;i<999;i++){ %>
>>>
>>> <html:option value="<%=i%>"><%=i%></html:option>
>>>
>>> <%}%>
>>>
>>> </html:select>
>
> -- 
> Kris Schneider <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: simple question

Posted by Kris Schneider <kr...@dotech.com>.
I know the question is targeted at doing this in a JSP, but why wouldn't you
just set up a String[100] in application scope, name it "numbers" (or whatever)
and do something like:

<html:select property="selectBox" styleClass="content">
  <html:options name="numbers"/>
</html:select>

Quoting Mark Lowe <ma...@talk21.com>:

> Nothing to add really just a few variations on a theme.
> 
> <c:forEach var="num" begin="0" end="999">
> 	<html-el:option value=${num}">
> 		<c:out value="${num}" />
> 	</html-el:option>
> </c:forEach>
> 
> i think
> 
> <c:forEach var="num" begin="0" end="999">
> 	<htmll:option value=<%= num %>"><%= num %>" /></html:option>
> </c:forEach>
> 
> will also work although perhaps you need to convert the int to a string.
> 
> 
> 
> On 19 Dec 2003, at 12:50, dirk wrote:
> 
> > I want to create a select box with the values 1 thru 100 how can i do 
> > that? What i have is:
> > But that is not working. Any idea ?
> > Thanks !
> > <html:select property="selectBox" styleClass="content">
> >
> > <% for(int i=0;i<999;i++){ %>
> >
> > <html:option value="<%=i%>"><%=i%></html:option>
> >
> > <%}%>
> >
> > </html:select>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: simple question

Posted by Mark Lowe <ma...@talk21.com>.
Nothing to add really just a few variations on a theme.

<c:forEach var="num" begin="0" end="999">
	<html-el:option value=${num}">
		<c:out value="${num}" />
	</html-el:option>
</c:forEach>

i think

<c:forEach var="num" begin="0" end="999">
	<htmll:option value=<%= num %>"><%= num %>" /></html:option>
</c:forEach>

will also work although perhaps you need to convert the int to a string.



On 19 Dec 2003, at 12:50, dirk wrote:

> I want to create a select box with the values 1 thru 100 how can i do 
> that? What i have is:
> But that is not working. Any idea ?
> Thanks !
> <html:select property="selectBox" styleClass="content">
>
> <% for(int i=0;i<999;i++){ %>
>
> <html:option value="<%=i%>"><%=i%></html:option>
>
> <%}%>
>
> </html:select>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org