Re: How To Display Check Boxes in Struts?

2004-10-08 Thread Caroline Jen
Thank you very much for your reply and your code.  My
check boxes and other requirements are working now.

-Caroline
--- [EMAIL PROTECTED] wrote:

> 
> 
> 
> 
> 
> I'll assume you have an iteration in your JSP  that
> goes like this:
> 
>  id="client">
> ...
>  
> 
> 
> where "clients" corresponds to your collection of
> client beans.  (ie you
> have a method in your form called 'getClients()'
> that returns a List.)
> The id "client" is the name I've made up for the
> bean that comes into scope
> for each iteration (ie it corresponds to an element
> in the "clients"
> collection).
> 
> You need another collection in your form to
> represent the selected clients.
> Let's call it 'selectedClients'.
> You can then place the following code within the
> above iterate:
> 
>   property="selectedClients"/>
>property="emailAddress"/>
>  
>   property="title"/>
>   property="lastName"/>
> 
> 
> You will need the following code in your form to
> support the property
> 'selectedClients':
> 
> private String[] selectedclients = new
> String[0];
> 
> public String[] getSelectedClients() { 
> return selectedclients;  }
> public void setSelectedClients(String[] value) {
> selectedclients =
> value; }
> 
> And add this to your form's reset method:
> 
>selectedclients = new String[0];
> 
> The effect of the above is to display a check-box
> for every client, and
> present/collect the correct setting for the
> check-box.
> 
> 
> 
> 
> 
> |-+>
> | |   Caroline Jen |
> | |   <[EMAIL PROTECTED]|
> | |   .com>|
> | ||
> | |   06/10/2004 03:19 |
> | |   PM   |
> | |   Please respond to|
> | |   "Struts Users|
> | |   Mailing List"|
> | ||
> |-+>
>  
>
>--|
>   | 
> 
>|
>   |   To:   [EMAIL PROTECTED]  
> 
>|
>   |   cc:   
> 
>|
>   |   Subject:  How To Display Check Boxes in
> Struts? 
>   |
>  
>
>--|
> 
> 
> 
> 
> I am able to create check boxes using HTML. But, I
> do
> not know how to display check boxes in Struts.
> 
> Here is what I plan to do:
> 
> I have a JavaBean, which gets its properties
> populated
> through database table query. For example, this
> JavaBean has three properties; lastName, title,
> emailAddress.
> 
> And I have a Collection of such a JavaBean because
> there are thousands of people in the database table.
> 
> Now, it gets to the JSP web page. I am going to
> display a table with four columns:
> 
> first column: a check box
> second column: Last Name
> third column: Title
> fourth column: E-Mail Address
> 
> If client puts a check mark in a check box, the
> value
> of the emailAddress is passed for processing.
> 
> How do I display check boxes from a Collection of
> JavaBean?
> 
> 
> 
> ___
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
> 
>
-
> 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]
> 
> 




___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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



Re: How To Display Check Boxes in Struts?

2004-10-05 Thread jthompson





I should add that my previous post provides a mechanism for displaying your
check-boxes and capturing the user's responses.

You'll still need some code in your Action that processes the form to
recover the selected responses, something like this:

 String[] sc = questionform.getSelectedClients();






|-+>
| |   [EMAIL PROTECTED]|
| |   o.nz |
| ||
| |   06/10/2004 04:05 |
| |   PM   |
| |   Please respond to|
| |   "Struts Users|
| |   Mailing List"|
| ||
|-+>
  
>--|
  |
  |
  |   To:   "Struts Users Mailing List" <[EMAIL PROTECTED]>
 |
  |   cc:  
                  |
  |       Subject:  Re: How To Display Check Boxes in Struts?  
  |
  
>--|









I'll assume you have an iteration in your JSP  that goes like this:


...
 


where "clients" corresponds to your collection of client beans.  (ie you
have a method in your form called 'getClients()' that returns a List.)
The id "client" is the name I've made up for the bean that comes into scope
for each iteration (ie it corresponds to an element in the "clients"
collection).

You need another collection in your form to represent the selected clients.
Let's call it 'selectedClients'.
You can then place the following code within the above iterate:

 
  
 
 
 


You will need the following code in your form to support the property
'selectedClients':

private String[] selectedclients = new String[0];

public String[] getSelectedClients() {  return selectedclients;  }
public void setSelectedClients(String[] value) { selectedclients =
value; }

And add this to your form's reset method:

   selectedclients = new String[0];

The effect of the above is to display a check-box for every client, and
present/collect the correct setting for the check-box.





|-+>
| |   Caroline Jen |
| |   <[EMAIL PROTECTED]|
| |   .com>|
| ||
| |   06/10/2004 03:19 |
| |   PM   |
| |   Please respond to|
| |   "Struts Users|
| |   Mailing List"|
| ||
|-+>
  
>--|

  |
  |
  |   To:   [EMAIL PROTECTED]
  |
  |   cc:
  |
  |   Subject:  How To Display Check Boxes in Struts?
  |
  
>--|




I am able to create check boxes using HTML. But, I do
not know how to display check boxes in Struts.

Here is what I plan to do:

I have a JavaBean, which gets its properties populated
through database table query. For example, this
JavaBean has three properties; lastName, title,
emailAddress.

And I have a Collection of such a JavaBean because
there are thousands of people in the database table.

Now, it gets to the JSP web page. I am going to
display a table with four columns:

first column: a check box
second column: Last Name
third column: Title
fourth column: E-Mail Address

If client puts a check mark in a check box, the value
of the emailAddress is passed for processing.

How do I display check boxes from a Collection of JavaBean?



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

-
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: How To Display Check Boxes in Struts?

2004-10-05 Thread jthompson





I'll assume you have an iteration in your JSP  that goes like this:


...
 


where "clients" corresponds to your collection of client beans.  (ie you
have a method in your form called 'getClients()' that returns a List.)
The id "client" is the name I've made up for the bean that comes into scope
for each iteration (ie it corresponds to an element in the "clients"
collection).

You need another collection in your form to represent the selected clients.
Let's call it 'selectedClients'.
You can then place the following code within the above iterate:

 
  
 
 
 


You will need the following code in your form to support the property
'selectedClients':

private String[] selectedclients = new String[0];

public String[] getSelectedClients() {  return selectedclients;  }
public void setSelectedClients(String[] value) { selectedclients =
value; }

And add this to your form's reset method:

   selectedclients = new String[0];

The effect of the above is to display a check-box for every client, and
present/collect the correct setting for the check-box.





|-+>
| |   Caroline Jen |
| |   <[EMAIL PROTECTED]|
| |   .com>|
| ||
| |   06/10/2004 03:19 |
| |   PM   |
| |   Please respond to|
| |   "Struts Users|
| |   Mailing List"|
| ||
|-+>
  
>--|
  |
  |
  |   To:   [EMAIL PROTECTED]  
 |
  |   cc:  
  |
  |   Subject:  How To Display Check Boxes in Struts?  
  |
  
>--|




I am able to create check boxes using HTML. But, I do
not know how to display check boxes in Struts.

Here is what I plan to do:

I have a JavaBean, which gets its properties populated
through database table query. For example, this
JavaBean has three properties; lastName, title,
emailAddress.

And I have a Collection of such a JavaBean because
there are thousands of people in the database table.

Now, it gets to the JSP web page. I am going to
display a table with four columns:

first column: a check box
second column: Last Name
third column: Title
fourth column: E-Mail Address

If client puts a check mark in a check box, the value
of the emailAddress is passed for processing.

How do I display check boxes from a Collection of JavaBean?



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

-
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: How To Display Check Boxes in Struts?

2004-10-05 Thread lixin chu
something like this:
)"
value="x"/>

--- Caroline Jen <[EMAIL PROTECTED]> wrote:

> I am able to create check boxes using HTML. But, I
> do
> not know how to display check boxes in Struts.
> 
> Here is what I plan to do:
> 
> I have a JavaBean, which gets its properties
> populated
> through database table query. For example, this
> JavaBean has three properties; lastName, title,
> emailAddress.
> 
> And I have a Collection of such a JavaBean because
> there are thousands of people in the database table.
> 
> Now, it gets to the JSP web page. I am going to
> display a table with four columns:
> 
> first column: a check box
> second column: Last Name
> third column: Title
> fourth column: E-Mail Address
> 
> If client puts a check mark in a check box, the
> value
> of the emailAddress is passed for processing.
> 
> How do I display check boxes from a Collection of
> JavaBean?
> 
> 
>   
> ___
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 




__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

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