Re: [S2] checkboxes in each row of table - set values in action

2008-04-09 Thread Laurie Harper

lbastil wrote:

Thank you for the help.
But I could not get it to work.

Here is a code sample from the Action Class:


private Set traegerPermissions;


The class TraegerPermissions itself have another collection:

private Collection einrichtungen;



And both TraegerPermission and EinrichtungPermission define the 
appropriate getter and setter methods for the id, number, name and 
writepermission properties?



In jsp I have successful read access:


[...]   

[...]

[...]



In neither case are you binding the checkbox input fields to the 
underlying model. You need to change the 'name' attributes to fully 
dereference the model property so Struts knows where to store the 
submitted values. Something like this (untested):


  


  name="traegerPermissions[i1.index].einrichtungen[i2.index]" .../>


Take a look at the various example applications, as the above may not be 
exactly right (that's just off the top of my head).


L.


what shall I save in order to can write back changes in the Checkboxes
to the model by struts2 out of box approach?

I tries several settings without success ...

thank you,
Basti



Laurie Harper wrote:
Provided the checkbox is properly bound to the collection entry, yes. 
You need to specify the name of the s:checkbox (or any other input type) 
as userCollection[index].userProperty where 'userCollection' is the name 
of the Collection property on your action, index comes from the iterator 
and userProperty is the property to bind to.


L.

lbastil wrote:

Thank you for reply!

I just wonder:

I understand it would work out of box for 1 User-Object, if I bound
checkbox
to permission property of this user.
But I wonder it should work out of box if I use (as I described)
Collection
of Users in Action
and on jsp side iterator tag, and checkbox tag within iterator is bound
to
permission properties of users in the iterated Collection.

This does not matter, it should work the same as for single user object?


Thank you,
Basti


Laurie Harper wrote:

lbastil wrote:

Hello,

I have the following problem:

in action i have a collection of class User
each class User have different attributes, one is: boolean permission

in JSP I use struts 2 iterator tag to iterate the User Objects.
For each User entry I create one row in table.
for displaying/changing the boolean permission value I use S2 checkbox
tag

so far it works fine and show all data in collection of Users correct.

But how can I set changed checkbox values (the permission attribute)
back
to
action?
If your checkbox is bound the the permission property of the user, 
submitting the form should update the property. If that's not happening, 
you need to give more details: what your JSP code looks like, and the 
relevant bits of your action and User code, at least.


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: [S2] checkboxes in each row of table - set values in action

2008-04-07 Thread lbastil

Thank you for the help.

But I could not get it to work.

Here is a code sample from the Action Class:

...
private Set traegerPermissions;
...

The class TraegerPermissions itself have another collection:
...
private Collection einrichtungen;
...

In jsp I have successful read access:
...

">

Träger - id 






   





">


 Einrichtung









...

what shall I save in order to can write back changes in the Checkboxes
to the model by struts2 out of box approach?

I tries several settings without success ...

thank you,
Basti



Laurie Harper wrote:
> 
> Provided the checkbox is properly bound to the collection entry, yes. 
> You need to specify the name of the s:checkbox (or any other input type) 
> as userCollection[index].userProperty where 'userCollection' is the name 
> of the Collection property on your action, index comes from the iterator 
> and userProperty is the property to bind to.
> 
> L.
> 
> lbastil wrote:
>> Thank you for reply!
>> 
>> I just wonder:
>> 
>> I understand it would work out of box for 1 User-Object, if I bound
>> checkbox
>> to permission property of this user.
>> But I wonder it should work out of box if I use (as I described)
>> Collection
>> of Users in Action
>> and on jsp side iterator tag, and checkbox tag within iterator is bound
>> to
>> permission properties of users in the iterated Collection.
>> 
>> This does not matter, it should work the same as for single user object?
>> 
>> 
>> Thank you,
>> Basti
>> 
>> 
>> Laurie Harper wrote:
>>> lbastil wrote:
 Hello,

 I have the following problem:

 in action i have a collection of class User
 each class User have different attributes, one is: boolean permission

 in JSP I use struts 2 iterator tag to iterate the User Objects.
 For each User entry I create one row in table.
 for displaying/changing the boolean permission value I use S2 checkbox
 tag

 so far it works fine and show all data in collection of Users correct.

 But how can I set changed checkbox values (the permission attribute)
 back
 to
 action?
>>> If your checkbox is bound the the permission property of the user, 
>>> submitting the form should update the property. If that's not happening, 
>>> you need to give more details: what your JSP code looks like, and the 
>>> relevant bits of your action and User code, at least.
>>>
>>> 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]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--checkboxes-in-each-row-of-table---set-values-in-action-tp16446895p16537273.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] checkboxes in each row of table - set values in action

2008-04-03 Thread Laurie Harper
Provided the checkbox is properly bound to the collection entry, yes. 
You need to specify the name of the s:checkbox (or any other input type) 
as userCollection[index].userProperty where 'userCollection' is the name 
of the Collection property on your action, index comes from the iterator 
and userProperty is the property to bind to.


L.

lbastil wrote:

Thank you for reply!

I just wonder:

I understand it would work out of box for 1 User-Object, if I bound checkbox
to permission property of this user.
But I wonder it should work out of box if I use (as I described) Collection
of Users in Action
and on jsp side iterator tag, and checkbox tag within iterator is bound to
permission properties of users in the iterated Collection.

This does not matter, it should work the same as for single user object?


Thank you,
Basti


Laurie Harper wrote:

lbastil wrote:

Hello,

I have the following problem:

in action i have a collection of class User
each class User have different attributes, one is: boolean permission

in JSP I use struts 2 iterator tag to iterate the User Objects.
For each User entry I create one row in table.
for displaying/changing the boolean permission value I use S2 checkbox
tag

so far it works fine and show all data in collection of Users correct.

But how can I set changed checkbox values (the permission attribute) back
to
action?
If your checkbox is bound the the permission property of the user, 
submitting the form should update the property. If that's not happening, 
you need to give more details: what your JSP code looks like, and the 
relevant bits of your action and User code, at least.


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: [S2] checkboxes in each row of table - set values in action

2008-04-03 Thread lbastil

Thank you for reply!

I just wonder:

I understand it would work out of box for 1 User-Object, if I bound checkbox
to permission property of this user.
But I wonder it should work out of box if I use (as I described) Collection
of Users in Action
and on jsp side iterator tag, and checkbox tag within iterator is bound to
permission properties of users in the iterated Collection.

This does not matter, it should work the same as for single user object?


Thank you,
Basti


Laurie Harper wrote:
> 
> lbastil wrote:
>> Hello,
>> 
>> I have the following problem:
>> 
>> in action i have a collection of class User
>> each class User have different attributes, one is: boolean permission
>> 
>> in JSP I use struts 2 iterator tag to iterate the User Objects.
>> For each User entry I create one row in table.
>> for displaying/changing the boolean permission value I use S2 checkbox
>> tag
>> 
>> so far it works fine and show all data in collection of Users correct.
>> 
>> But how can I set changed checkbox values (the permission attribute) back
>> to
>> action?
> 
> If your checkbox is bound the the permission property of the user, 
> submitting the form should update the property. If that's not happening, 
> you need to give more details: what your JSP code looks like, and the 
> relevant bits of your action and User code, at least.
> 
> L.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--checkboxes-in-each-row-of-table---set-values-in-action-tp16446895p16467308.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] checkboxes in each row of table - set values in action

2008-04-02 Thread Laurie Harper

lbastil wrote:

Hello,

I have the following problem:

in action i have a collection of class User
each class User have different attributes, one is: boolean permission

in JSP I use struts 2 iterator tag to iterate the User Objects.
For each User entry I create one row in table.
for displaying/changing the boolean permission value I use S2 checkbox tag

so far it works fine and show all data in collection of Users correct.

But how can I set changed checkbox values (the permission attribute) back to
action?


If your checkbox is bound the the permission property of the user, 
submitting the form should update the property. If that's not happening, 
you need to give more details: what your JSP code looks like, and the 
relevant bits of your action and User code, at least.


L.


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



RE: [S2] Checkboxes

2007-12-03 Thread Dave Newton
Oh, that's clever, I don't think I would have thought
of that, and it's a lot quicker than my ideas ;)

d.

--- "Hoying, Ken" <[EMAIL PROTECTED]> wrote:

> Thanks, Dave!
> 
> This got me moving in the right direction.  For
> future reference, I
> ended using the checkboxlist tag inside of my loop
> and set the list
> attribute to a single value so I would only get the
> one option.  This
> seems to have solved my issue.
> 
> Thanks,
> Ken
> 
> -Original Message-
> From: Dave Newton [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 30, 2007 6:06 PM
> To: Struts Users Mailing List
> Subject: RE: [S2] Checkboxes
> 
> A single checkbox, AFAIK, only expects to check a
> single value, not an
> array or collection.
> 
> I would consider using a modified version of the
> checkboxlist tag if
> it's just a matter of the rendered HTML you're
> having an issue with.
> 
> d.
> 
> --- "Hoying, Ken" <[EMAIL PROTECTED]> wrote:
> 
> > Thank you for the response.
> > 
> > I had looked at the example, but it really appears
> to only push the 
> > checkbox results to the action.  I am not sure
> that it would 
> > repopulate the checkbox with the values.
> > 
> > I do not believe that checkbox list is going to
> work for me as it does
> 
> > not give me control on where to put the
> checkboxes.
> > I need one in each
> > row.
> > 
> > It appears that my understanding of how the
> checkbox works is not 
> > correct.
> > 
> > I am expecting that the checkbox control will call
> the
> > getSelectedContracts() method and see if any of
> these values in the 
> > array it returns matches the value specified in
> the fieldValue 
> > attribute specified in the checkbox tag.  If there
> is a match then 
> > check the box, if not don't check it.  However,
> all of my checkboxes 
> > are always being selected no matter what.
> > 
> > I am also expecting that when submitting the form,
> > setSelectedContracts() will be called with an
> array of the values that
> 
> > were selected.  This does appear to be working
> with one caveat. If 
> > nothing is selected then I get the error: Invalid
> field value for 
> > field "selectedContracts".
> > 
> > This obviously does not work the way I thought and
> I was hoping 
> > someone could maybe explain how it does work as I
> am really struggling
> 
> > on gaining an understanding of this tag and its
> usage.
> > 
> > Thanks in advance,
> > Ken
> > 
> > -Original Message-
> > From: Martin Gainty [mailto:[EMAIL PROTECTED]
> > Sent: Friday, November 30, 2007 11:09 AM
> > To: Struts Users Mailing List
> > Subject: Re: [S2] Checkboxes
> > 
> > Hi Ken-
> > 
> > struts.xml has this definition of EmployeeAction
> where results 
> > populate editEmployee.jsp
> >  >
>
class="org.apache.struts2.showcase.action.EmployeeAction"
> > method="delete">
> >  > name="error">/empmanager/editEmployee.jsp
> >  >
>
type="redirect">edit-${currentEmployee.empId}.action
> > 
> > 
> > looking at the results jsp
> > /empmanager/editEmployee.jsp has a checkbox
> defined as  > fieldValue="true" label="Married"
> > name="currentEmployee.married"/>
> > 
> > The EmployeeAction is defined as
> > package org.apache.struts2.showcase.action;
> > public class EmployeeAction extends
> > AbstractCRUDAction implements
> > Preparable {  private Employee currentEmployee;
> > 
> > whereas Employee is defined as
> > package org.apache.struts2.showcase.model;
> > public class Employee implements IdEntity {
> > private boolean married; //checkbox
> > 
> > so the individual checkbox works fine for setting
> booleans 
> > http://struts.apache.org/2.0.11/docs/checkbox.html
> > 
> > For handling a list of checkboxes you may want to
> implement with 
> > checkboxlist?
> >
>
http://struts.apache.org/2.0.11/docs/checkboxlist.html
> > 
> > M--
> > - Original Message -
> > From: "Hoying, Ken" <[EMAIL PROTECTED]>
> > To: 
> > Sent: Friday, November 30, 2007 8:45 AM
> > Subject: [S2] Checkboxes
> > 
> > 
> > I am having a difficult time getting checkboxes to
> work in the 
> > following scenario and am not sure what I am doing
> wrong.  An

RE: [S2] Checkboxes

2007-12-03 Thread Hoying, Ken
Thanks, Dave!

This got me moving in the right direction.  For future reference, I
ended using the checkboxlist tag inside of my loop and set the list
attribute to a single value so I would only get the one option.  This
seems to have solved my issue.

Thanks,
Ken

-Original Message-
From: Dave Newton [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 30, 2007 6:06 PM
To: Struts Users Mailing List
Subject: RE: [S2] Checkboxes

A single checkbox, AFAIK, only expects to check a single value, not an
array or collection.

I would consider using a modified version of the checkboxlist tag if
it's just a matter of the rendered HTML you're having an issue with.

d.

--- "Hoying, Ken" <[EMAIL PROTECTED]> wrote:

> Thank you for the response.
> 
> I had looked at the example, but it really appears to only push the 
> checkbox results to the action.  I am not sure that it would 
> repopulate the checkbox with the values.
> 
> I do not believe that checkbox list is going to work for me as it does

> not give me control on where to put the checkboxes.
> I need one in each
> row.
> 
> It appears that my understanding of how the checkbox works is not 
> correct.
> 
> I am expecting that the checkbox control will call the
> getSelectedContracts() method and see if any of these values in the 
> array it returns matches the value specified in the fieldValue 
> attribute specified in the checkbox tag.  If there is a match then 
> check the box, if not don't check it.  However, all of my checkboxes 
> are always being selected no matter what.
> 
> I am also expecting that when submitting the form,
> setSelectedContracts() will be called with an array of the values that

> were selected.  This does appear to be working with one caveat. If 
> nothing is selected then I get the error: Invalid field value for 
> field "selectedContracts".
> 
> This obviously does not work the way I thought and I was hoping 
> someone could maybe explain how it does work as I am really struggling

> on gaining an understanding of this tag and its usage.
> 
> Thanks in advance,
> Ken
> 
> -Original Message-----
> From: Martin Gainty [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 30, 2007 11:09 AM
> To: Struts Users Mailing List
> Subject: Re: [S2] Checkboxes
> 
> Hi Ken-
> 
> struts.xml has this definition of EmployeeAction where results 
> populate editEmployee.jsp
> 
class="org.apache.struts2.showcase.action.EmployeeAction"
> method="delete">
>  name="error">/empmanager/editEmployee.jsp
> 
type="redirect">edit-${currentEmployee.empId}.action
> 
> 
> looking at the results jsp
> /empmanager/editEmployee.jsp has a checkbox defined as  fieldValue="true" label="Married"
> name="currentEmployee.married"/>
> 
> The EmployeeAction is defined as
> package org.apache.struts2.showcase.action;
> public class EmployeeAction extends
> AbstractCRUDAction implements
> Preparable {  private Employee currentEmployee;
> 
> whereas Employee is defined as
> package org.apache.struts2.showcase.model;
> public class Employee implements IdEntity {
> private boolean married; //checkbox
> 
> so the individual checkbox works fine for setting booleans 
> http://struts.apache.org/2.0.11/docs/checkbox.html
> 
> For handling a list of checkboxes you may want to implement with 
> checkboxlist?
>
http://struts.apache.org/2.0.11/docs/checkboxlist.html
> 
> M--
> - Original Message -
> From: "Hoying, Ken" <[EMAIL PROTECTED]>
> To: 
> Sent: Friday, November 30, 2007 8:45 AM
> Subject: [S2] Checkboxes
> 
> 
> I am having a difficult time getting checkboxes to work in the 
> following scenario and am not sure what I am doing wrong.  Any help or

> guidance would be greatly appreciated.
> 
> I have table which displays several rows.  In the first column of each

> row, I have a check box to select that row.  I am keeping track of 
> user selections so when they return to the page, the checkboxes are 
> prepopulated with their previous selections.
> 
> 
> My Action contains the following:
> 
> public Long[] getSelectedContracts()
> {
> return setSelectedContracts.toArray(new Long[0]); }
> // end
> getSelectedContracts
> 
> /**
> * This setter takes the provided String[] of
> selected contract ids.
> */
> public void setSelectedContracts(Long[]
> palngSelectedContracts)
>   {
> 
>
setSelectedContracts.addAll(Arrays.asList(palngSelectedContracts));
> } // end setSelectedContracts
> 
> My JSP contains the following:
> 
>  fieldValue="${cont

RE: [S2] Checkboxes

2007-11-30 Thread Dave Newton
A single checkbox, AFAIK, only expects to check a
single value, not an array or collection.

I would consider using a modified version of the
checkboxlist tag if it's just a matter of the rendered
HTML you're having an issue with.

d.

--- "Hoying, Ken" <[EMAIL PROTECTED]> wrote:

> Thank you for the response.
> 
> I had looked at the example, but it really appears
> to only push the
> checkbox results to the action.  I am not sure that
> it would repopulate
> the checkbox with the values.
> 
> I do not believe that checkbox list is going to work
> for me as it does
> not give me control on where to put the checkboxes. 
> I need one in each
> row.
> 
> It appears that my understanding of how the checkbox
> works is not
> correct.
> 
> I am expecting that the checkbox control will call
> the
> getSelectedContracts() method and see if any of
> these values in the
> array it returns matches the value specified in the
> fieldValue attribute
> specified in the checkbox tag.  If there is a match
> then check the box,
> if not don't check it.  However, all of my
> checkboxes are always being
> selected no matter what.
> 
> I am also expecting that when submitting the form,
> setSelectedContracts() will be called with an array
> of the values that
> were selected.  This does appear to be working with
> one caveat. If
> nothing is selected then I get the error: Invalid
> field value for field
> "selectedContracts".
> 
> This obviously does not work the way I thought and I
> was hoping someone
> could maybe explain how it does work as I am really
> struggling on
> gaining an understanding of this tag and its usage.
> 
> Thanks in advance,
> Ken
> 
> -Original Message-
> From: Martin Gainty [mailto:[EMAIL PROTECTED] 
> Sent: Friday, November 30, 2007 11:09 AM
> To: Struts Users Mailing List
> Subject: Re: [S2] Checkboxes
> 
> Hi Ken-
> 
> struts.xml has this definition of EmployeeAction
> where results populate
> editEmployee.jsp
> 
class="org.apache.struts2.showcase.action.EmployeeAction"
> method="delete">
>  name="error">/empmanager/editEmployee.jsp
> 
type="redirect">edit-${currentEmployee.empId}.action
> 
> 
> looking at the results jsp
> /empmanager/editEmployee.jsp has a checkbox defined
> as  fieldValue="true" label="Married"
> name="currentEmployee.married"/>
> 
> The EmployeeAction is defined as
> package org.apache.struts2.showcase.action;
> public class EmployeeAction extends
> AbstractCRUDAction implements
> Preparable {  private Employee currentEmployee;
> 
> whereas Employee is defined as
> package org.apache.struts2.showcase.model;
> public class Employee implements IdEntity {
> private boolean married; //checkbox
> 
> so the individual checkbox works fine for setting
> booleans
> http://struts.apache.org/2.0.11/docs/checkbox.html
> 
> For handling a list of checkboxes you may want to
> implement with
> checkboxlist?
>
http://struts.apache.org/2.0.11/docs/checkboxlist.html
> 
> M--
> - Original Message -
> From: "Hoying, Ken" <[EMAIL PROTECTED]>
> To: 
> Sent: Friday, November 30, 2007 8:45 AM
> Subject: [S2] Checkboxes
> 
> 
> I am having a difficult time getting checkboxes to
> work in the following
> scenario and am not sure what I am doing wrong.  Any
> help or guidance
> would be greatly appreciated.
> 
> I have table which displays several rows.  In the
> first column of each
> row, I have a check box to select that row.  I am
> keeping track of user
> selections so when they return to the page, the
> checkboxes are
> prepopulated with their previous selections.
> 
> 
> My Action contains the following:
> 
> public Long[] getSelectedContracts()
> {
> return setSelectedContracts.toArray(new Long[0]); }
> // end
> getSelectedContracts
> 
> /**
> * This setter takes the provided String[] of
> selected contract ids.
> */
> public void setSelectedContracts(Long[]
> palngSelectedContracts)
>   {
> 
>
setSelectedContracts.addAll(Arrays.asList(palngSelectedContracts));
> } // end setSelectedContracts
> 
> My JSP contains the following:
> 
>  fieldValue="${contract.npcContractId}"/>
> 
> 
> 
> 
> 
> 
> -
> ***Note:The information contained in this message
> may be privileged and
> confidential and protected from disclosure. If the
> reader of this
> message is not the intended re

RE: [S2] Checkboxes

2007-11-30 Thread Hoying, Ken
Thank you for the response.

I had looked at the example, but it really appears to only push the
checkbox results to the action.  I am not sure that it would repopulate
the checkbox with the values.

I do not believe that checkbox list is going to work for me as it does
not give me control on where to put the checkboxes.  I need one in each
row.

It appears that my understanding of how the checkbox works is not
correct.

I am expecting that the checkbox control will call the
getSelectedContracts() method and see if any of these values in the
array it returns matches the value specified in the fieldValue attribute
specified in the checkbox tag.  If there is a match then check the box,
if not don't check it.  However, all of my checkboxes are always being
selected no matter what.

I am also expecting that when submitting the form,
setSelectedContracts() will be called with an array of the values that
were selected.  This does appear to be working with one caveat. If
nothing is selected then I get the error: Invalid field value for field
"selectedContracts".

This obviously does not work the way I thought and I was hoping someone
could maybe explain how it does work as I am really struggling on
gaining an understanding of this tag and its usage.

Thanks in advance,
Ken

-Original Message-
From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 30, 2007 11:09 AM
To: Struts Users Mailing List
Subject: Re: [S2] Checkboxes

Hi Ken-

struts.xml has this definition of EmployeeAction where results populate
editEmployee.jsp

/empmanager/editEmployee.jsp
edit-${currentEmployee.empId}.action


looking at the results jsp
/empmanager/editEmployee.jsp has a checkbox defined as 

The EmployeeAction is defined as
package org.apache.struts2.showcase.action;
public class EmployeeAction extends AbstractCRUDAction implements
Preparable {  private Employee currentEmployee;

whereas Employee is defined as
package org.apache.struts2.showcase.model;
public class Employee implements IdEntity {
private boolean married; //checkbox

so the individual checkbox works fine for setting booleans
http://struts.apache.org/2.0.11/docs/checkbox.html

For handling a list of checkboxes you may want to implement with
checkboxlist?
http://struts.apache.org/2.0.11/docs/checkboxlist.html

M--
- Original Message -
From: "Hoying, Ken" <[EMAIL PROTECTED]>
To: 
Sent: Friday, November 30, 2007 8:45 AM
Subject: [S2] Checkboxes


I am having a difficult time getting checkboxes to work in the following
scenario and am not sure what I am doing wrong.  Any help or guidance
would be greatly appreciated.

I have table which displays several rows.  In the first column of each
row, I have a check box to select that row.  I am keeping track of user
selections so when they return to the page, the checkboxes are
prepopulated with their previous selections.


My Action contains the following:

public Long[] getSelectedContracts()
{
return setSelectedContracts.toArray(new Long[0]); } // end
getSelectedContracts

/**
* This setter takes the provided String[] of selected contract ids.
*/
public void setSelectedContracts(Long[] palngSelectedContracts)
  {

setSelectedContracts.addAll(Arrays.asList(palngSelectedContracts));
} // end setSelectedContracts

My JSP contains the following:








-
***Note:The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, you
are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received this
communication in error, please notify the Sender immediately by replying
to the message and deleting it from your computer. Thank you. Premier
Inc.


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


-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.

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



Re: [S2] Checkboxes

2007-11-30 Thread Martin Gainty
Hi Ken-

struts.xml has this definition of EmployeeAction where results populate
editEmployee.jsp

/empmanager/editEmployee.jsp
edit-${currentEmployee.empId}.action


looking at the results jsp
/empmanager/editEmployee.jsp has a checkbox defined as


The EmployeeAction is defined as
package org.apache.struts2.showcase.action;
public class EmployeeAction extends AbstractCRUDAction implements Preparable
{
 private Employee currentEmployee;

whereas Employee is defined as
package org.apache.struts2.showcase.model;
public class Employee implements IdEntity {
private boolean married; //checkbox

so the individual checkbox works fine for setting booleans
http://struts.apache.org/2.0.11/docs/checkbox.html

For handling a list of checkboxes you may want to implement with
checkboxlist?
http://struts.apache.org/2.0.11/docs/checkboxlist.html

M--
- Original Message -
From: "Hoying, Ken" <[EMAIL PROTECTED]>
To: 
Sent: Friday, November 30, 2007 8:45 AM
Subject: [S2] Checkboxes


I am having a difficult time getting checkboxes to work in the following
scenario and am not sure what I am doing wrong.  Any help or guidance
would be greatly appreciated.

I have table which displays several rows.  In the first column of each
row, I have a check box to select that row.  I am keeping track of user
selections so when they return to the page, the checkboxes are
prepopulated with their previous selections.


My Action contains the following:

public Long[] getSelectedContracts()
{
return setSelectedContracts.toArray(new Long[0]);
} // end getSelectedContracts

/**
* This setter takes the provided String[] of selected contract
ids.
*/
public void setSelectedContracts(Long[] palngSelectedContracts)
  {

setSelectedContracts.addAll(Arrays.asList(palngSelectedContracts));
} // end setSelectedContracts

My JSP contains the following:








-
***Note:The information contained in this message may be privileged
and confidential and protected from disclosure. If the reader of
this message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient,
you are hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify the Sender
immediately by replying to the message and deleting it from your
computer. Thank you. Premier Inc.


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