is there a reason you can just use webworks select tags?


Bernard Choi wrote:


Well... the following meets your condition for not using collections or arrays...
<% for (int day = 1; day <= 31; day++) { %>
<option <%if (day = selectedDay) {%>selected<%}%>><%=day%></option>
<% } %>
Not using collections or arrays => more visually complex.
Does "object creation" has that large an impact on the server to warrant complex-looking codes ?
I feel that the above is visually more complex, and more difficult to read, even if it does not use collections or arrays. Why is there the contraint for "excessive object creation" on the server ? Why does it "seem wrong" ? There is object creation, but I don't think they are "excessive" as they function to help make readable code.


    ----- Original Message -----
    *From:* John Patterson <mailto:[EMAIL PROTECTED]>
    *To:* [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    *Sent:* Friday, September 12, 2003 4:39 AM
    *Subject:* Re: [OS-webwork] Loop to create days

I am using jsp for the view. I would not want to use a collection
or array for a simple "for" construct due to added complexity and
excessive object creation. It just seems wrong. I need to set one
of the values "selected"...
<option value="22" selected>22</option>
...by comparing the loop variable with a property on my action. ----- Original Message -----


        *From:* Bernard Choi <mailto:[EMAIL PROTECTED]>
        *To:* [EMAIL PROTECTED]
        <mailto:[EMAIL PROTECTED]>
        *Sent:* Thursday, September 11, 2003 7:30 PM
        *Subject:* Re: [OS-webwork] Loop to create days

Greetings,
Is the following acceptable ?
#foreach( $day in [1..31] )
<option value="$day">$day</option>
#end
What is your concern with using collections or arrays ?


            ----- Original Message -----
            *From:* John Patterson <mailto:[EMAIL PROTECTED]>
            *To:* Webwork
            <mailto:[EMAIL PROTECTED]>
            *Sent:* Friday, September 12, 2003 12:16 AM
            *Subject:* [OS-webwork] Loop to create days

Hi,
I would like to create a list of day options for a select
like so:
<option value="1">1</option>
<option value="2">2</option>
...
<option value="31">31</option>
Can I do this without using a collection or array of numbers
and iterating through them?
Thanks,
John.





------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to