Re: Struts2 Dynamic Checkboxes

2007-06-04 Thread Torsten Römer
Ah, I am such a dingbat... the beans in my list contained a property
with the same name as I used for the Collection property in the backing
bean. So when the tag was checking if the option was there or not it was
looking at some boolean property of that bean instead into the Collection.

Not before I downloaded the Struts2 source and debugged the
ListUIBean.compare() method I realized that ;-)

So this answers my question, and I am happy to say that my dynamic
checkboxes now work perfectly!

The Dingbat

Torsten Römer schrieb:
 I think I found an OK solution but one thing does not work and I don't
 understand why.
 
 So what I am doing is creating single checkboxes in an iterator,
 disabling the automatically generated label through a modified simple
 theme and creating my custom labels:
   
 s:iterator value=cars
   s:label
 s:checkboxlist templateDir=template
 template=checkboxlist.ftl
 theme=nolabel
 name=car
 list=%{''+name}/   
 s:text
 name=format.moneyrounds:param value=price//s:text
 s:property value=name/
   /s:label  
   /s:iterator
 
 cars is a List of simple beans with, among other, a name property.
 The car property is a Collection. When I check a checkbox and submit
 the form, I can see that an XWorkList containing the value is passed to
 setCar().
 BUT: When the form is redisplayed, as because of a validation error, the
 getCar() method is not called and the checkbox is not checked.
 
 Can anyone tell me why?
 
 If I move the s:checkboxlist tag outside the s:iterator, it works,
 but like this I can't create my custom labels, which is what this is all
 about...
 
 Torsten
 
 Torsten Römer schrieb:
 Well, why not try both ways... it will be a good exercise no matter what.

 I'll get back when I have some interesting experiences to share with.

 Thanks again!

 Torsten

 Dave Newton schrieb:
 --- Torsten Römer [EMAIL PROTECTED] wrote:
 I see there is no point in what I am trying to do.
 Oh, I don't know about that.

 You could use a map (or list) for the checkbox values
 and gather up the result values that way, couldn't
 you? 

 You just need to pre-populate the map (or list) in the
 action before hitting the view.

 d.




 Be
  a better Globetrotter. Get better travel answers from someone who knows. 
 Yahoo! Answers - Check it out.
 http://answers.yahoo.com/dir/?link=listsid=396545469

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-30 Thread Torsten Römer
I think I found an OK solution but one thing does not work and I don't
understand why.

So what I am doing is creating single checkboxes in an iterator,
disabling the automatically generated label through a modified simple
theme and creating my custom labels:

s:iterator value=cars
  s:label
s:checkboxlist templateDir=template
template=checkboxlist.ftl
theme=nolabel
name=car
list=%{''+name}/ 
s:text
name=format.moneyrounds:param value=price//s:text
s:property value=name/  
  /s:label
/s:iterator

cars is a List of simple beans with, among other, a name property.
The car property is a Collection. When I check a checkbox and submit
the form, I can see that an XWorkList containing the value is passed to
setCar().
BUT: When the form is redisplayed, as because of a validation error, the
getCar() method is not called and the checkbox is not checked.

Can anyone tell me why?

If I move the s:checkboxlist tag outside the s:iterator, it works,
but like this I can't create my custom labels, which is what this is all
about...

Torsten

Torsten Römer schrieb:
 Well, why not try both ways... it will be a good exercise no matter what.
 
 I'll get back when I have some interesting experiences to share with.
 
 Thanks again!
 
 Torsten
 
 Dave Newton schrieb:
 --- Torsten Römer [EMAIL PROTECTED] wrote:
 I see there is no point in what I am trying to do.
 Oh, I don't know about that.

 You could use a map (or list) for the checkbox values
 and gather up the result values that way, couldn't
 you? 

 You just need to pre-populate the map (or list) in the
 action before hitting the view.

 d.




 Be
  a better Globetrotter. Get better travel answers from someone who knows. 
 Yahoo! Answers - Check it out.
 http://answers.yahoo.com/dir/?link=listsid=396545469

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-24 Thread Skip Hollowell
I have been struggling with the very same problem.  So you say 
pre-populate the map/list.  Would you make that a separate  data 
structure, or part of the object already being passed?  Let's say it's 
separate, just add the Map/List to the action, create setter and 
getters, and make sure and recreate the list when ever a function of the 
action is called that returns to the page where you display the list and 
the choices?


Dave Newton-4 wrote:
--- Torsten Römer [EMAIL PROTECTED] 
http://www.nabble.com/user/SendEmail.jtp?type=postpost=10769733i=0 
wrote:

 I see there is no point in what I am trying to do.

Oh, I don't know about that.

You could use a map (or list) for the checkbox values
and gather up the result values that way, couldn't
you?

You just need to pre-populate the map (or list) in the
action before hitting the view.





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-24 Thread Dave Newton
--- Skip Hollowell [EMAIL PROTECTED] wrote:
 Would you make that a separate  data structure, or 
 part of the object already being passed?

For me, that would depend on what the underlying data
model was, I suppose.

 Let's say it's separate, just add the Map/List to
the
 action, create setter and getters, and make sure and

 recreate the list when ever a function of the 
 action is called that returns to the page where you
 display the list and the choices?

Yep... in its simplest form, it's really pretty
straight-forward. There's all sorts of cool ways to
mess it up later ;)

d.



   
Luggage?
 GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=oni_on_mailp=graduation+giftscs=bz

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-24 Thread Skip Hollowell

Dave Newton-4 wrote:


Yep... in its simplest form, it's really pretty
straight-forward. There's all sorts of cool ways to
mess it up later ;)
THAT'S the one part of this that I don't need any help with.  I can mess 
things up with the best of them.


Thanks again Dave for your input.  It's greatly aprpeciated.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-24 Thread Dave Newton
--- Skip Hollowell [EMAIL PROTECTED] wrote:
 Thanks again Dave for your input.  It's greatly
 aprpeciated.

Ha ha, don't thank me until something actually works.

d.



   
Be
 a better Heartthrob. Get better relationship answers from someone who knows. 
Yahoo! Answers - Check it out. 
http://answers.yahoo.com/dir/?link=listsid=396545433

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-23 Thread Dave Newton
--- Torsten Römer [EMAIL PROTECTED] wrote:
 I have a varying number of checkboxes on a form and
 would like to somehow get a list of the selected 
 checkboxes or a map and of course it would be nice
if
 the checkboxes would remember their state...

http://struts.apache.org/2.x/docs/checkboxlist.html

Does that meet your needs?

d.



   
Building
 a website is a piece of cake. Yahoo! Small Business gives you all the tools to 
get online.
http://smallbusiness.yahoo.com/webhosting 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-23 Thread Torsten Römer
It sure does and I already looked at it, but I was trying to create
single checkboxes in an s:iterator in order to be able to put them in
a custom layout.

I kind of have the same problem with radiobuttons so I guess I should
reconsider my design so I can use the default markup and thus the tags
as they are supposed to be used...

I see there is no point in what I am trying to do.

Thanks!

Torsten

Dave Newton wrote:
 --- Torsten Römer [EMAIL PROTECTED] wrote:
 I have a varying number of checkboxes on a form and
 would like to somehow get a list of the selected 
 checkboxes or a map and of course it would be nice
 if
 the checkboxes would remember their state...
 
 http://struts.apache.org/2.x/docs/checkboxlist.html
 
 Does that meet your needs?
 
 d.
 
 
 

 Building
  a website is a piece of cake. Yahoo! Small Business gives you all the tools 
 to get online.
 http://smallbusiness.yahoo.com/webhosting 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-23 Thread Dave Newton
--- Torsten Römer [EMAIL PROTECTED] wrote:
 I see there is no point in what I am trying to do.

Oh, I don't know about that.

You could use a map (or list) for the checkbox values
and gather up the result values that way, couldn't
you? 

You just need to pre-populate the map (or list) in the
action before hitting the view.

d.



   
Be
 a better Globetrotter. Get better travel answers from someone who knows. 
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=listsid=396545469

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 Dynamic Checkboxes

2007-05-23 Thread Torsten Römer
Well, why not try both ways... it will be a good exercise no matter what.

I'll get back when I have some interesting experiences to share with.

Thanks again!

Torsten

Dave Newton schrieb:
 --- Torsten Römer [EMAIL PROTECTED] wrote:
 I see there is no point in what I am trying to do.
 
 Oh, I don't know about that.
 
 You could use a map (or list) for the checkbox values
 and gather up the result values that way, couldn't
 you? 
 
 You just need to pre-populate the map (or list) in the
 action before hitting the view.
 
 d.
 
 
 

 Be
  a better Globetrotter. Get better travel answers from someone who knows. 
 Yahoo! Answers - Check it out.
 http://answers.yahoo.com/dir/?link=listsid=396545469
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]