Re: Dynamically Initializing Checkbox Value

2006-09-01 Thread Albert L. Sapp
Anthony, See my comments below. Hope this clears things up a little and I see Laurie has made a worthwhile comment about looking at the examples available. HTH, Al Anthony N. Frasso wrote: My head hurts. :) Thanks for everyone's help. I've gotten a number of responses, it's just that I

Re: Dynamically Initializing Checkbox Value

2006-08-31 Thread Laurie Harper
Anthony N. Frasso wrote: My head hurts. :) Thanks for everyone's help. I've gotten a number of responses, it's just that I'm still confused. It's obvious I have something drastically wrong with my understanding of the workflow of Struts, so I'd like to clear that up now. Let's take my list pa

Re: Dynamically Initializing Checkbox Value

2006-08-31 Thread Anthony N. Frasso
My head hurts. :) Thanks for everyone's help. I've gotten a number of responses, it's just that I'm still confused. It's obvious I have something drastically wrong with my understanding of the workflow of Struts, so I'd like to clear that up now. Let's take my list page, ListRoles.jsp:

Re: Dynamically Initializing Checkbox Value

2006-08-30 Thread Laurie Harper
Yes you do, the form is passed in as one of the parameters to execute(). The typical pattern is for the action to be invoked via an action mapping, populate the form bean and forward to the JSP. It's during this action processing that you copy your business data into the form bean, thus initial

Re: Dynamically Initializing Checkbox Value

2006-08-30 Thread Michael Jouravlev
On 8/30/06, Anthony N. Frasso <[EMAIL PROTECTED]> wrote: I don't have the form bean until I get to the JSP page, so there's no way to initialize it. Struts being a classic Model 2 framework requires all requests to go through an action. Well, this is not a strict requirement just a standard pra

Re: Dynamically Initializing Checkbox Value

2006-08-30 Thread Anthony N. Frasso
I guess I don't follow How do I prepopulate the form bean? I have a list page which lists all of the roles in the system. When the form on the list page is submitted, I can retrieve the ID of the role that the user wants to edit. In the action class I then retrieve that role, and put it int

Re: Dynamically Initializing Checkbox Value

2006-08-30 Thread Albert L. Sapp
Anthony, I am puzzled by your comment that you don't have a form bean before you get to the jsp. We do this all the time. Say I want to display a list of inventory items for a user. I retrieve a list of inventory items matching the query data the user gave me and create an array of invento

Re: Dynamically Initializing Checkbox Value

2006-08-30 Thread Anthony N. Frasso
Actually, that's incorrect. I want to *read* from the Role bean. I want to *write* to the form bean. I just don't know how to go about it yet. :) It seems like I have to read/write to the same form bean, which doesn't make sense, because I don't have the form bean until I get to the JSP page, s

Re: Dynamically Initializing Checkbox Value

2006-08-30 Thread Puneet Lakhina
On 8/30/06, Anthony N. Frasso <[EMAIL PROTECTED]> wrote: Hello all, public class Role { private int id; private String name; private String description; private boolean permissionA; private boolean permissionB; ... private boolean permissionN; } Each of those prop

Re: Dynamically Initializing Checkbox Value

2006-08-29 Thread Anthony N. Frasso
Hello all, OK. I admit I am thoroughly confused. :) > Note that there's a > special > consideration for checkboxes, though: if a checkbox > is de-selected when > the form is submitted, *no* URL parameter will be > included for it. As a > result, Struts has no way to automatically clear > your

Re: Dynamically Initializing Checkbox Value

2006-08-28 Thread Laurie Harper
Anthony N. Frasso wrote: Do you need one checkbox or a series of checkboxes? Just one. :) For one checkbox you write something like this (from the article): As I understand it, what this tag does is place the value "yes" into the property "married" of the form bean associated with this HTM

Re: Dynamically Initializing Checkbox Value

2006-08-28 Thread Anthony N. Frasso
> Do you need one checkbox or a series of checkboxes? Just one. :) > For one checkbox you write something like this (from > the article): > As I understand it, what this tag does is place the value "yes" into the property "married" of the form bean associated with this HTML form (actually, "yes

Re: Dynamically Initializing Checkbox Value

2006-08-28 Thread Michael Jouravlev
Do you need one checkbox or a series of checkboxes? For one checkbox you write something like this (from the article): For a group of checkbox you can create several checkbox HTML elements with the same name (this is what does for you). Looking at the example from the article, "customers" is

Re: Dynamically Initializing Checkbox Value

2006-08-28 Thread Anthony N. Frasso
Thanks, I appreciate the quick response. Unfortunately, I'm not sure that this addresses my issue, unless I've misunderstood something. It doesn't really mention how to populate a checkbox with a value... but it does provide the following: This creates a checkbox for each cu

Re: Dynamically Initializing Checkbox Value

2006-08-28 Thread Michael Jouravlev
On 8/28/06, Anthony N. Frasso <[EMAIL PROTECTED]> wrote: Hello all, and thanks for your help in advance. I have a relatively simple JSP that I'm trying to present. I have a bean that is accessible as an attribute in the request, as well as a form bean for the form on this page. As an example,

Dynamically Initializing Checkbox Value

2006-08-28 Thread Anthony N. Frasso
Hello all, and thanks for your help in advance. I have a relatively simple JSP that I'm trying to present. I have a bean that is accessible as an attribute in the request, as well as a form bean for the form on this page. As an example, here is one of the input components for the form: This t