RE: Re: checkbox for nested collection

2005-12-08 Thread Neil Meyer
Thanks Laurie,

It worked perfectly.

Neil Meyer

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
Sent: 07 December 2005 12:30 AM
To: user@struts.apache.org
Subject: Re: checkbox for nested collection

Neil Meyer wrote:
> Good day,
> 
> I read all the topics on checkboxes in this list but couldn't find a
solution
> for my problem. I hope there is somebody that can shed some light on this
to
> me.
> 
> I have a dynamic list of menu items that is retrieved from a database into
an
> array property.
> 
> I have to array properties one with all menu items available and one with
the
> user items allocated.
> 
> When I render my JSP I need the array list of all items to display. See
> example below:
> 
> 
> 
>   
> 
>   
>   
>   
> 
> 
> What I need now is to pre check the relevant menu items from the array
> specific to the user.
> 
> Any help will be appreciated.

You need to set the values in the menuItemsSelected form bean property 
to reflect the array specific to the user. I'm not too sure from your 
description what that means in practice, but the result you're looking 
for is for the menuItemsSelected property to contain only those values 
which should be checked.

L.


-
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: Re: checkbox for nested collection

2005-12-06 Thread Neil Meyer
Thanks I will try that.

Regards
Neil Meyer

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
Sent: 07 December 2005 12:30 AM
To: user@struts.apache.org
Subject: Re: checkbox for nested collection

Neil Meyer wrote:
> Good day,
> 
> I read all the topics on checkboxes in this list but couldn't find a
solution
> for my problem. I hope there is somebody that can shed some light on this
to
> me.
> 
> I have a dynamic list of menu items that is retrieved from a database into
an
> array property.
> 
> I have to array properties one with all menu items available and one with
the
> user items allocated.
> 
> When I render my JSP I need the array list of all items to display. See
> example below:
> 
> 
> 
>   
> 
>   
>   
>   
> 
> 
> What I need now is to pre check the relevant menu items from the array
> specific to the user.
> 
> Any help will be appreciated.

You need to set the values in the menuItemsSelected form bean property 
to reflect the array specific to the user. I'm not too sure from your 
description what that means in practice, but the result you're looking 
for is for the menuItemsSelected property to contain only those values 
which should be checked.

L.


-
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: checkbox for nested collection

2005-12-06 Thread Laurie Harper

Neil Meyer wrote:

Good day,

I read all the topics on checkboxes in this list but couldn't find a solution
for my problem. I hope there is somebody that can shed some light on this to
me.

I have a dynamic list of menu items that is retrieved from a database into an
array property.

I have to array properties one with all menu items available and one with the
user items allocated.

When I render my JSP I need the array list of all items to display. See
example below:










What I need now is to pre check the relevant menu items from the array
specific to the user.

Any help will be appreciated.


You need to set the values in the menuItemsSelected form bean property 
to reflect the array specific to the user. I'm not too sure from your 
description what that means in practice, but the result you're looking 
for is for the menuItemsSelected property to contain only those values 
which should be checked.


L.


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



RE: checkbox for nested collection

2005-12-06 Thread Neil Meyer
Good day,

I read all the topics on checkboxes in this list but couldn't find a solution
for my problem. I hope there is somebody that can shed some light on this to
me.

I have a dynamic list of menu items that is retrieved from a database into an
array property.

I have to array properties one with all menu items available and one with the
user items allocated.

When I render my JSP I need the array list of all items to display. See
example below:










What I need now is to pre check the relevant menu items from the array
specific to the user.

Any help will be appreciated.

Regards
Neil Meyer


-Original Message-
From: Per Jørgen Walstrøm [mailto:[EMAIL PROTECTED] 
Sent: 02 December 2005 04:39 PM
To: Struts Users Mailing List
Subject: Re: checkbox for nested collection

ok, I finally solved it. Here is what I did:

1) in my form's reset()-method, I iterate through all my sectionComponents
and set restrictive=false
2) after the reset()-method is run, I do session.evict() on all my
sectionComponents to remove them from the Hibernate-cache
3) I reload all the sectionComponents from the database and put them back
into the form. When Struts renders my jsp later on, the checkboxes represents
the values from the database, and not all falses as set in 1)

when submitting the form, the reset()-method is then automatically run once
more, setting all values to false. And when the form is populated, the
correct values are being set to my sectionComponents

took me some time to figure this one out, even though it seems quite easy :-)

cheers,
pj
 

-Opprinnelig melding-
Fra: Per Jørgen Walstrøm 
Sendt: 2. desember 2005 09:26
Til: Struts Users Mailing List
Emne: SV: Re: SV: Re: checkbox for nested collection

thank you for your answer. I think I know the request processing life-cycle,
but what I apparently do not know, is how to map those checkboxes... The
thing is that the "restrictive"-property is a direct mapping to the database;
I do actually have a column called restrictive, which contains boolean
values. So when I iterate over my collection geSectionComponents, what I
really do is to lazily fetch the values from the database. I do not have an
intermediate representation of those values in my form. So I do not know how
to reset those values _without changing the actual values_.


   

I am not sure how to go about to do this, but it seems to me that I might
need some intermediate values in my form and that I have to set the
sectionComponent.restrictive values manually, based on the intermediate
values. It just seems like an unnecessary extra step...

cheers,
pj

-Opprinnelig melding-
Fra: Laurie Harper [mailto:[EMAIL PROTECTED]
Sendt: 1. desember 2005 19:44
Til: user@struts.apache.org
Emne: Re: SV: Re: checkbox for nested collection

The trick is understanding the request processing life-cycle. The following
is the sequence of events:

   - Struts either instantiates the action form or, if you use session
 scoped forms and one already exists, retrieves it from the session

   - Struts calls reset() on the form (I *think* in all cases, but it
 may only do this when retrieving a form from session scope)

   - if this request is a form submit, the form data is stored into
 the form bean

   - Struts calls your action, passing in the form bean

   - In your pre-populate action, you would set the boolean properties
 in the form ready for display; in your form processing action, you
 would read their state reflecting the request data

   - You return a forward mapping that Struts uses to render the next
 view

So, you set everything to false in reset(); *after* that, your setup action
gets the opportunity to set the properties as appropriate for display. On the
next request, when the form is submitted, reset() is called which clears the
boolean properties and then they're updated based on the form data.

L.

Per Jørgen Walstrøm wrote:
> hello,
> you are right, I do have access to the POJO and the properties and I am
able to pre-populate the form. However, the checkboxes are rendered
dynamically in the jsp from the getRestrictive() method of my
GeSectionComponent. I can't really set them all to false beforehand, because
then they would not be populated right, I guess... Don't know if I'm making
myself clear, but I can't see how I can reset my checkboxes without resetting
the actual properties. Should I try to use a multibox with an array of
dynamic size (i.e. a size which depends on the size of the
geSectionComponents-Collection)?
> 
> /pj
> 
> -Opprinnelig melding-
> Fra: Laurie Harper [mailto:[EMAIL PROTECTED]
> Sendt: 1. desember 2005 00:03
> Til: user@struts.apache.org
> Emne: Re: checkbox for nested collection
> 
> Per Jørgen Walstrøm wrote:
>> hello,
>> I have the following code in my jsp:
>>

Re: SV: Re: SV: Re: checkbox for nested collection

2005-12-04 Thread Laurie Harper
Yes, it sounds like your problem is the lack of a place to store an 
intermediate representation. The usual approach is to have properties on 
your action form which you populate from the business object, and copy 
those properties back onto the business object when you're ready to 
commit them. BeanUtils.copyProperties() can be a way to do the copying 
very simply.


L.

Per Jørgen Walstrøm wrote:

thank you for your answer. I think I know the request processing life-cycle, but what I 
apparently do not know, is how to map those checkboxes... The thing is that the 
"restrictive"-property is a direct mapping to the database; I do actually have 
a column called restrictive, which contains boolean values. So when I iterate over my 
collection geSectionComponents, what I really do is to lazily fetch the values from the 
database. I do not have an intermediate representation of those values in my form. So I 
do not know how to reset those values _without changing the actual values_.


  


I am not sure how to go about to do this, but it seems to me that I might need 
some intermediate values in my form and that I have to set the 
sectionComponent.restrictive values manually, based on the intermediate values. 
It just seems like an unnecessary extra step...

cheers,
pj

-Opprinnelig melding-
Fra: Laurie Harper [mailto:[EMAIL PROTECTED] 
Sendt: 1. desember 2005 19:44

Til: user@struts.apache.org
Emne: Re: SV: Re: checkbox for nested collection

The trick is understanding the request processing life-cycle. The following is 
the sequence of events:

   - Struts either instantiates the action form or, if you use session
 scoped forms and one already exists, retrieves it from the session

   - Struts calls reset() on the form (I *think* in all cases, but it
 may only do this when retrieving a form from session scope)

   - if this request is a form submit, the form data is stored into
 the form bean

   - Struts calls your action, passing in the form bean

   - In your pre-populate action, you would set the boolean properties
 in the form ready for display; in your form processing action, you
 would read their state reflecting the request data

   - You return a forward mapping that Struts uses to render the next
 view

So, you set everything to false in reset(); *after* that, your setup action 
gets the opportunity to set the properties as appropriate for display. On the 
next request, when the form is submitted, reset() is called which clears the 
boolean properties and then they're updated based on the form data.

L.

Per Jørgen Walstrøm wrote:

hello,
you are right, I do have access to the POJO and the properties and I am able to 
pre-populate the form. However, the checkboxes are rendered dynamically in the 
jsp from the getRestrictive() method of my GeSectionComponent. I can't really 
set them all to false beforehand, because then they would not be populated 
right, I guess... Don't know if I'm making myself clear, but I can't see how I 
can reset my checkboxes without resetting the actual properties. Should I try 
to use a multibox with an array of dynamic size (i.e. a size which depends on 
the size of the geSectionComponents-Collection)?

/pj

-Opprinnelig melding-
Fra: Laurie Harper [mailto:[EMAIL PROTECTED]
Sendt: 1. desember 2005 00:03
Til: user@struts.apache.org
Emne: Re: checkbox for nested collection

Per Jørgen Walstrøm wrote:

hello,
I have the following code in my jsp:


   

my Collection geSectionComponents contains objects of type 
GeSectionComponent


GeSectionComponent.java (an auto-generated Hibernate POJO), contains the 
following field (with getter and setter):
private Boolean restrictive;

How do I go about to make sure Struts detects when I uncheck a checkbox? I am 
aware of that I should set all corresponding boolean properties to false in the 
reset()-method, but in this case I do not have any direct access to those 
properties.

any suggestions?
What do you mean you don't have any direct access to those properties? 
You must be creating a reference to that object (or retrieving one through Hibernate) somewhere in your code. Assuming you're storing the POJO in your form bean as part of pre-population, you can then access it in your reset() method.


L.




-
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: checkbox for nested collection

2005-12-02 Thread Per Jørgen Walstrøm
ok, I finally solved it. Here is what I did:

1) in my form's reset()-method, I iterate through all my sectionComponents and 
set restrictive=false
2) after the reset()-method is run, I do session.evict() on all my 
sectionComponents to remove them from the Hibernate-cache
3) I reload all the sectionComponents from the database and put them back into 
the form. When Struts renders my jsp later on, the checkboxes represents the 
values from the database, and not all falses as set in 1)

when submitting the form, the reset()-method is then automatically run once 
more, setting all values to false. And when the form is populated, the correct 
values are being set to my sectionComponents

took me some time to figure this one out, even though it seems quite easy :-)

cheers,
pj
 

-Opprinnelig melding-
Fra: Per Jørgen Walstrøm 
Sendt: 2. desember 2005 09:26
Til: Struts Users Mailing List
Emne: SV: Re: SV: Re: checkbox for nested collection

thank you for your answer. I think I know the request processing life-cycle, 
but what I apparently do not know, is how to map those checkboxes... The thing 
is that the "restrictive"-property is a direct mapping to the database; I do 
actually have a column called restrictive, which contains boolean values. So 
when I iterate over my collection geSectionComponents, what I really do is to 
lazily fetch the values from the database. I do not have an intermediate 
representation of those values in my form. So I do not know how to reset those 
values _without changing the actual values_.


   

I am not sure how to go about to do this, but it seems to me that I might need 
some intermediate values in my form and that I have to set the 
sectionComponent.restrictive values manually, based on the intermediate values. 
It just seems like an unnecessary extra step...

cheers,
pj

-Opprinnelig melding-
Fra: Laurie Harper [mailto:[EMAIL PROTECTED]
Sendt: 1. desember 2005 19:44
Til: user@struts.apache.org
Emne: Re: SV: Re: checkbox for nested collection

The trick is understanding the request processing life-cycle. The following is 
the sequence of events:

   - Struts either instantiates the action form or, if you use session
 scoped forms and one already exists, retrieves it from the session

   - Struts calls reset() on the form (I *think* in all cases, but it
 may only do this when retrieving a form from session scope)

   - if this request is a form submit, the form data is stored into
 the form bean

   - Struts calls your action, passing in the form bean

   - In your pre-populate action, you would set the boolean properties
 in the form ready for display; in your form processing action, you
 would read their state reflecting the request data

   - You return a forward mapping that Struts uses to render the next
 view

So, you set everything to false in reset(); *after* that, your setup action 
gets the opportunity to set the properties as appropriate for display. On the 
next request, when the form is submitted, reset() is called which clears the 
boolean properties and then they're updated based on the form data.

L.

Per Jørgen Walstrøm wrote:
> hello,
> you are right, I do have access to the POJO and the properties and I am able 
> to pre-populate the form. However, the checkboxes are rendered dynamically in 
> the jsp from the getRestrictive() method of my GeSectionComponent. I can't 
> really set them all to false beforehand, because then they would not be 
> populated right, I guess... Don't know if I'm making myself clear, but I 
> can't see how I can reset my checkboxes without resetting the actual 
> properties. Should I try to use a multibox with an array of dynamic size 
> (i.e. a size which depends on the size of the geSectionComponents-Collection)?
> 
> /pj
> 
> -Opprinnelig melding-
> Fra: Laurie Harper [mailto:[EMAIL PROTECTED]
> Sendt: 1. desember 2005 00:03
> Til: user@struts.apache.org
> Emne: Re: checkbox for nested collection
> 
> Per Jørgen Walstrøm wrote:
>> hello,
>> I have the following code in my jsp:
>>
>> 
>>
>>
>> my Collection geSectionComponents contains objects of type 
>> GeSectionComponent
>>
>> GeSectionComponent.java (an auto-generated Hibernate POJO), contains the 
>> following field (with getter and setter):
>> private Boolean restrictive;
>>
>> How do I go about to make sure Struts detects when I uncheck a checkbox? I 
>> am aware of that I should set all corresponding boolean properties to false 
>> in the reset()-method, but in this case I do not have any direct access to 
>> those properties.
>>
>> any suggestions?
> 
> What do you mean you don't have any direct access to those properties? 
> You must be creating a re

SV: Re: SV: Re: checkbox for nested collection

2005-12-02 Thread Per Jørgen Walstrøm
thank you for your answer. I think I know the request processing life-cycle, 
but what I apparently do not know, is how to map those checkboxes... The thing 
is that the "restrictive"-property is a direct mapping to the database; I do 
actually have a column called restrictive, which contains boolean values. So 
when I iterate over my collection geSectionComponents, what I really do is to 
lazily fetch the values from the database. I do not have an intermediate 
representation of those values in my form. So I do not know how to reset those 
values _without changing the actual values_.


  


I am not sure how to go about to do this, but it seems to me that I might need 
some intermediate values in my form and that I have to set the 
sectionComponent.restrictive values manually, based on the intermediate values. 
It just seems like an unnecessary extra step...

cheers,
pj

-Opprinnelig melding-
Fra: Laurie Harper [mailto:[EMAIL PROTECTED] 
Sendt: 1. desember 2005 19:44
Til: user@struts.apache.org
Emne: Re: SV: Re: checkbox for nested collection

The trick is understanding the request processing life-cycle. The following is 
the sequence of events:

   - Struts either instantiates the action form or, if you use session
 scoped forms and one already exists, retrieves it from the session

   - Struts calls reset() on the form (I *think* in all cases, but it
 may only do this when retrieving a form from session scope)

   - if this request is a form submit, the form data is stored into
 the form bean

   - Struts calls your action, passing in the form bean

   - In your pre-populate action, you would set the boolean properties
 in the form ready for display; in your form processing action, you
 would read their state reflecting the request data

   - You return a forward mapping that Struts uses to render the next
 view

So, you set everything to false in reset(); *after* that, your setup action 
gets the opportunity to set the properties as appropriate for display. On the 
next request, when the form is submitted, reset() is called which clears the 
boolean properties and then they're updated based on the form data.

L.

Per Jørgen Walstrøm wrote:
> hello,
> you are right, I do have access to the POJO and the properties and I am able 
> to pre-populate the form. However, the checkboxes are rendered dynamically in 
> the jsp from the getRestrictive() method of my GeSectionComponent. I can't 
> really set them all to false beforehand, because then they would not be 
> populated right, I guess... Don't know if I'm making myself clear, but I 
> can't see how I can reset my checkboxes without resetting the actual 
> properties. Should I try to use a multibox with an array of dynamic size 
> (i.e. a size which depends on the size of the geSectionComponents-Collection)?
> 
> /pj
> 
> -Opprinnelig melding-
> Fra: Laurie Harper [mailto:[EMAIL PROTECTED]
> Sendt: 1. desember 2005 00:03
> Til: user@struts.apache.org
> Emne: Re: checkbox for nested collection
> 
> Per Jørgen Walstrøm wrote:
>> hello,
>> I have the following code in my jsp:
>>
>> 
>>
>>
>> my Collection geSectionComponents contains objects of type 
>> GeSectionComponent
>>
>> GeSectionComponent.java (an auto-generated Hibernate POJO), contains the 
>> following field (with getter and setter):
>> private Boolean restrictive;
>>
>> How do I go about to make sure Struts detects when I uncheck a checkbox? I 
>> am aware of that I should set all corresponding boolean properties to false 
>> in the reset()-method, but in this case I do not have any direct access to 
>> those properties.
>>
>> any suggestions?
> 
> What do you mean you don't have any direct access to those properties? 
> You must be creating a reference to that object (or retrieving one through 
> Hibernate) somewhere in your code. Assuming you're storing the POJO in your 
> form bean as part of pre-population, you can then access it in your reset() 
> method.
> 
> L.
> 
> 
> 
> 
> -
> 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: SV: Re: checkbox for nested collection

2005-12-01 Thread Laurie Harper
The trick is understanding the request processing life-cycle. The 
following is the sequence of events:


  - Struts either instantiates the action form or, if you use session
scoped forms and one already exists, retrieves it from the session

  - Struts calls reset() on the form (I *think* in all cases, but it
may only do this when retrieving a form from session scope)

  - if this request is a form submit, the form data is stored into
the form bean

  - Struts calls your action, passing in the form bean

  - In your pre-populate action, you would set the boolean properties
in the form ready for display; in your form processing action, you
would read their state reflecting the request data

  - You return a forward mapping that Struts uses to render the next
view

So, you set everything to false in reset(); *after* that, your setup 
action gets the opportunity to set the properties as appropriate for 
display. On the next request, when the form is submitted, reset() is 
called which clears the boolean properties and then they're updated 
based on the form data.


L.

Per Jørgen Walstrøm wrote:

hello,
you are right, I do have access to the POJO and the properties and I am able to 
pre-populate the form. However, the checkboxes are rendered dynamically in the 
jsp from the getRestrictive() method of my GeSectionComponent. I can't really 
set them all to false beforehand, because then they would not be populated 
right, I guess... Don't know if I'm making myself clear, but I can't see how I 
can reset my checkboxes without resetting the actual properties. Should I try 
to use a multibox with an array of dynamic size (i.e. a size which depends on 
the size of the geSectionComponents-Collection)?

/pj

-Opprinnelig melding-
Fra: Laurie Harper [mailto:[EMAIL PROTECTED] 
Sendt: 1. desember 2005 00:03

Til: user@struts.apache.org
Emne: Re: checkbox for nested collection

Per Jørgen Walstrøm wrote:

hello,
I have the following code in my jsp:


   

my Collection geSectionComponents contains objects of type 
GeSectionComponent


GeSectionComponent.java (an auto-generated Hibernate POJO), contains the 
following field (with getter and setter):
private Boolean restrictive;

How do I go about to make sure Struts detects when I uncheck a checkbox? I am 
aware of that I should set all corresponding boolean properties to false in the 
reset()-method, but in this case I do not have any direct access to those 
properties.

any suggestions?


What do you mean you don't have any direct access to those properties? 
You must be creating a reference to that object (or retrieving one through Hibernate) somewhere in your code. Assuming you're storing the POJO in your form bean as part of pre-population, you can then access it in your reset() method.


L.




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



SV: Re: checkbox for nested collection

2005-12-01 Thread Per Jørgen Walstrøm
hello,
you are right, I do have access to the POJO and the properties and I am able to 
pre-populate the form. However, the checkboxes are rendered dynamically in the 
jsp from the getRestrictive() method of my GeSectionComponent. I can't really 
set them all to false beforehand, because then they would not be populated 
right, I guess... Don't know if I'm making myself clear, but I can't see how I 
can reset my checkboxes without resetting the actual properties. Should I try 
to use a multibox with an array of dynamic size (i.e. a size which depends on 
the size of the geSectionComponents-Collection)?

/pj

-Opprinnelig melding-
Fra: Laurie Harper [mailto:[EMAIL PROTECTED] 
Sendt: 1. desember 2005 00:03
Til: user@struts.apache.org
Emne: Re: checkbox for nested collection

Per Jørgen Walstrøm wrote:
> hello,
> I have the following code in my jsp:
> 
> 
>
> 
> my Collection geSectionComponents contains objects of type 
> GeSectionComponent
> 
> GeSectionComponent.java (an auto-generated Hibernate POJO), contains the 
> following field (with getter and setter):
> private Boolean restrictive;
> 
> How do I go about to make sure Struts detects when I uncheck a checkbox? I am 
> aware of that I should set all corresponding boolean properties to false in 
> the reset()-method, but in this case I do not have any direct access to those 
> properties.
> 
> any suggestions?

What do you mean you don't have any direct access to those properties? 
You must be creating a reference to that object (or retrieving one through 
Hibernate) somewhere in your code. Assuming you're storing the POJO in your 
form bean as part of pre-population, you can then access it in your reset() 
method.

L.




-
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: checkbox for nested collection

2005-11-30 Thread Laurie Harper

Per Jørgen Walstrøm wrote:

hello,
I have the following code in my jsp:


  


my Collection geSectionComponents contains objects of type GeSectionComponent

GeSectionComponent.java (an auto-generated Hibernate POJO), contains the 
following field (with getter and setter):
private Boolean restrictive;

How do I go about to make sure Struts detects when I uncheck a checkbox? I am 
aware of that I should set all corresponding boolean properties to false in the 
reset()-method, but in this case I do not have any direct access to those 
properties.

any suggestions?


What do you mean you don't have any direct access to those properties? 
You must be creating a reference to that object (or retrieving one 
through Hibernate) somewhere in your code. Assuming you're storing the 
POJO in your form bean as part of pre-population, you can then access it 
in your reset() method.


L.




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



Re: checkbox for nested collection

2005-11-30 Thread Adam Hardy

Per Jørgen Walstrøm on 30/11/05 17:09, wrote:

hello, I have the following code in my jsp:


  

my Collection geSectionComponents contains objects of type
GeSectionComponent

GeSectionComponent.java (an auto-generated Hibernate POJO), contains
the following field (with getter and setter): private Boolean
restrictive;

How do I go about to make sure Struts detects when I uncheck a
checkbox? I am aware of that I should set all corresponding boolean
properties to false in the reset()-method, but in this case I do not
have any direct access to those properties.


Hmm. Interesting issue. The first thing to check is what happens to 
struts when you submit a non-boolean value to the nested property. It's 
always a good idea to code defensively, and if that causes an error when 
struts tries to map the http params into your nested bean, then you 
should change it to a string value.


Most properties that are populated direct from the request parameters 
should be type string.


But you said you can't change anything, which is bad. It sounds like a 
quiz question. I wouldn't implement it like this!


You need to do further testing to see what happens when you feed in 
different values that could come from your checkboxes, and that may 
depend on which browser you are using.


HTH
Adam

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



checkbox for nested collection

2005-11-30 Thread Per Jørgen Walstrøm
hello,
I have the following code in my jsp:


  


my Collection geSectionComponents contains objects of type GeSectionComponent

GeSectionComponent.java (an auto-generated Hibernate POJO), contains the 
following field (with getter and setter):
private Boolean restrictive;

How do I go about to make sure Struts detects when I uncheck a checkbox? I am 
aware of that I should set all corresponding boolean properties to false in the 
reset()-method, but in this case I do not have any direct access to those 
properties.

any suggestions?

cheers,
pj




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