We should add these into WW2... Please create a Jira issue...

> -----Original Message-----
> From: John Patterson [mailto:[EMAIL PROTECTED] 
> Sent: Friday, September 12, 2003 8:14 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [OS-webwork] Loop to create days
> 
> 
> I am using ww2 so there is no webwork.util.counter class.  I 
> don't know how it worked in ww1 but in ww2 the Iterator tag 
> will only use a Collection, Array, or a Map.  But you have 
> shown the kind of thing I would like to be able to do.
> 
> John.
> 
> --------------------------------------------------------------
> -------------
> Anders wrote:
> 
> What you want to do (I think) is:
> 
> <ww:bean name="'webwork.util.Counter'" id="'days'">
>    <ww:param name="'first'" value="'1'"/>
>    <WW:param name="'last'" value="'31'"/>
>    <ww:iterator>
>       <option value="<ww:property/>" <ww:if test=". ==
>       
> ../../yourActionAttribute">selected</ww:if>><ww:property/></option>
>    </ww:iterator>
> </ww:bean>
> 
> The above is untested, though.
> 
> //Anders
> 
> 
> On Fri, Sep 12, 2003 at 09:33:16AM +0100, John Patterson wrote:
> > I agree that the code you supplied is not the best (or 
> least complex) 
> > way
> to
> > solve this.  Using scriptlets is what I want to avoid (but 
> what I also 
> > resorted to).  However, the code that you gave does not solve the 
> > problem. I need to compare the  "loop variable with a 
> property on my 
> > action".
> >
> > Creating a collection to hold the numbers 1 to 31 is also a round 
> > about
> way
> > to achieve something very simple.
> >
> > I am not using the select control because, as far as I can tell, it 
> > does
> not
> > allow you to use it in forms that are not laid out in the simple 
> > single column design (is this correct?).  The control 
> header creates a 
> > new row in
> a
> > table (supplied by the <ww:form> element) with two <td>'s.  
> My design 
> > requires a more complex form layout.  It requires that two controls 
> > appear in the same row adjacent to each other.  Or is there 
> a way to 
> > get the
> Select
> > tag to work in these situations?
> >
> > What would be handy here is functionality similar to the 
> JSTL iterator 
> > tag that allows you to also specify a start value and an 
> end value.  
> > Maybe it could put the index value on the stack so that you 
> can easily 
> > use it in comparisons with properties on the Action.
> >
> > ----- Original Message -----
> > From: "Francisco Hernandez" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, September 12, 2003 3:11 AM
> > Subject: Re: [OS-webwork] Loop to create days
> >
> >
> > > 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
> > >
> >
> >
> > -------------------------------------------------------
> > 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
> >
> 
> -- 
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
> . . . . .
> . Anders Engström         [EMAIL PROTECTED]
> . http://www.gnejs.net    PGP-Key: ED010E7F
> . [Your mind is like an umbrella. It doesn't work unless you open it.]
> 
> 
> 
> -------------------------------------------------------
> 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
> 


-------------------------------------------------------
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