RE: checkbox and iterate problem

2003-02-27 Thread Phillip Qin
Sorry, my mistake, it is Boolean

ActionForm reset method is 

((OrderEntryLineItemForm)
iterator.next()).setMarkedForRemoval(Boolean.FALSE);


jsp is



Regards,
 
 
PQ
 
"This Guy Thinks He Knows Everything"
"This Guy Thinks He Knows What He Is Doing"

-Original Message-
From: Neal [mailto:[EMAIL PROTECTED] 
Sent: February 26, 2003 5:51 PM
To: [EMAIL PROTECTED]
Subject: RE: checkbox and iterate problem

I'm afraid you've lost me, I thought the propery HAD to be boolean for a
checkbox.
Can you please send me a code snippet of what you have working (even if
its different then what I am trying to do).

High level: I just want to read a list a of strings items from a DB, and
then populate a form with the items and let the user select them or not.

Thanx


> Mine is Collection, so I iterate thru the collection and set "false"
> (String) to each checked.
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -Original Message-
> From: Neal [mailto:[EMAIL PROTECTED]
> Sent: February 26, 2003 5:20 PM
> To: [EMAIL PROTECTED]
> Subject: RE: checkbox and iterate problem
>
> I changed everything from boolean (primative) to Boolean (Object type),
> no difference
> I still see the same behavior.
> After submit my setter function is not called.
> but for a non-indexed checkbox it is called.
>
> However the getter() is always called.
>
> Neal
>
>> try Boolean.FALSE (Object) instead of false (which is a primitive
>> type).
>>
>> Regards,
>>
>>
>> PQ
>>
>> "This Guy Thinks He Knows Everything"
>> "This Guy Thinks He Knows What He Is Doing"
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: February 26, 2003 2:04 PM
>> To: [EMAIL PROTECTED]
>> Subject: RE: checkbox and iterate problem
>>
>> I have a Reset method, and I am calling  mFolders[i].setChecked(false)
>> for each item in my array. Is that what you mean by setting the
>> default value ?
>> If so, it hasn't fixed my problem.
>>
>> Thanx
>>
>>> Have to set default value in reset method.
>>>
>>> Regards,
>>>
>>>
>>> PQ
>>>
>>> "This Guy Thinks He Knows Everything"
>>> "This Guy Thinks He Knows What He Is Doing"
>>>
>>> -Original Message-
>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>> Sent: February 26, 2003 1:18 PM
>>> To: [EMAIL PROTECTED]
>>> Subject: checkbox and iterate problem
>>>
>>> Hi,
>>>  I'm having a problem with checkboxes and I was hoping someone could
>>> help.
>>>
>>>  The short version is:
>>>when using  over an array of checkboxes, the
>>> setter
>>> method is not called after submit
>>>
>>>  Long version
>>>I have class   CheckableString { String str; boolean checked =
>>> false;
>>> // etc.. };
>>>I have a Form
>>>HostForm extends ActionForm {
>>>  CheckableString[] mFolders = new CheckableString[100];
>>> public CheckableString getFolder(int n) {
>>> System.err.println("HostForm getFolder a " + mFolders[n]);
>>> return mFolders[n];
>>> }
>>> public CheckableString[] getFolder() {
>>> System.err.println("HostForm getFolder b " + this);
>>> for (int i = 0; i != mFolders.length; i++) {
>>> System.err.println("HostForm getFolder b " +
>>> mFolders[i]);
>>> }
>>> return mFolders;
>>> }
>>> public void setFolder(int n, CheckableString folders) {
>>> System.err.println("HostForm setFolder a " + folders + " " +
>>> this);
>>> mFolders[n] = folders;
>>> }
>>> public void setFolder(CheckableString[] folders) {
>>> System.err.println("HostForm setFolder b " + this);
>>> mFolders = folders;
>>> }
>>> public void reset(ActionMapping a, HttpServletRequest b) {
>>> System.err.println("HostForm reset " + this);
>>> flag = false;
>>> for (int i = 0; i != mFolders.length; i++) {
>>> System.err.

RE: checkbox and iterate problem

2003-02-26 Thread Neal
I got it working..Thank you for your assistance.

I completely rewrote my code, and instead of using indexed=true, I
constructed the property inline using <%= blah %>
I'm not sure why I couldn;t get it working the first way, but now it works.

Neal


> Mine is Collection, so I iterate thru the collection and set "false"
> (String) to each checked.
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -Original Message-
> From: Neal [mailto:[EMAIL PROTECTED]
> Sent: February 26, 2003 5:20 PM
> To: [EMAIL PROTECTED]
> Subject: RE: checkbox and iterate problem
>
> I changed everything from boolean (primative) to Boolean (Object type),
> no difference
> I still see the same behavior.
> After submit my setter function is not called.
> but for a non-indexed checkbox it is called.
>
> However the getter() is always called.
>
> Neal
>
>> try Boolean.FALSE (Object) instead of false (which is a primitive
>> type).
>>
>> Regards,
>>
>>
>> PQ
>>
>> "This Guy Thinks He Knows Everything"
>> "This Guy Thinks He Knows What He Is Doing"
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: February 26, 2003 2:04 PM
>> To: [EMAIL PROTECTED]
>> Subject: RE: checkbox and iterate problem
>>
>> I have a Reset method, and I am calling  mFolders[i].setChecked(false)
>> for each item in my array. Is that what you mean by setting the
>> default value ?
>> If so, it hasn't fixed my problem.
>>
>> Thanx
>>
>>> Have to set default value in reset method.
>>>
>>> Regards,
>>>
>>>
>>> PQ
>>>
>>> "This Guy Thinks He Knows Everything"
>>> "This Guy Thinks He Knows What He Is Doing"
>>>
>>> -Original Message-
>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>> Sent: February 26, 2003 1:18 PM
>>> To: [EMAIL PROTECTED]
>>> Subject: checkbox and iterate problem
>>>
>>> Hi,
>>>  I'm having a problem with checkboxes and I was hoping someone could
>>> help.
>>>
>>>  The short version is:
>>>when using  over an array of checkboxes, the
>>> setter
>>> method is not called after submit
>>>
>>>  Long version
>>>I have class   CheckableString { String str; boolean checked =
>>> false;
>>> // etc.. };
>>>I have a Form
>>>HostForm extends ActionForm {
>>>  CheckableString[] mFolders = new CheckableString[100];
>>> public CheckableString getFolder(int n) {
>>> System.err.println("HostForm getFolder a " + mFolders[n]);
>>> return mFolders[n];
>>> }
>>> public CheckableString[] getFolder() {
>>> System.err.println("HostForm getFolder b " + this);
>>> for (int i = 0; i != mFolders.length; i++) {
>>> System.err.println("HostForm getFolder b " +
>>> mFolders[i]);
>>> }
>>> return mFolders;
>>> }
>>> public void setFolder(int n, CheckableString folders) {
>>> System.err.println("HostForm setFolder a " + folders + " " +
>>> this);
>>> mFolders[n] = folders;
>>> }
>>> public void setFolder(CheckableString[] folders) {
>>> System.err.println("HostForm setFolder b " + this);
>>> mFolders = folders;
>>> }
>>> public void reset(ActionMapping a, HttpServletRequest b) {
>>> System.err.println("HostForm reset " + this);
>>> flag = false;
>>> for (int i = 0; i != mFolders.length; i++) {
>>> System.err.println("HostForm reset "
>>> + mFolders[i]);
>>> if (mFolders[i] != null)
>>>
>>> mFolders[i].setChecked(false);
>>> }
>>> }
>>> }
>>>
>>> I have an Action class setup the form, populating values from a
>>> database,
>>> it then forwards to a jsp page
>>> 
>>> ..
>>> >> indexId="index">
>>> 
>>>   
>>> 
>&g

RE: checkbox and iterate problem

2003-02-26 Thread Neal
I'm afraid you've lost me, I thought the propery HAD to be boolean for a
checkbox.
Can you please send me a code snippet of what you have working (even if
its different then what I am trying to do).

High level: I just want to read a list a of strings items from a DB, and
then populate a form with the items and let the user select them or not.

Thanx


> Mine is Collection, so I iterate thru the collection and set "false"
> (String) to each checked.
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -Original Message-
> From: Neal [mailto:[EMAIL PROTECTED]
> Sent: February 26, 2003 5:20 PM
> To: [EMAIL PROTECTED]
> Subject: RE: checkbox and iterate problem
>
> I changed everything from boolean (primative) to Boolean (Object type),
> no difference
> I still see the same behavior.
> After submit my setter function is not called.
> but for a non-indexed checkbox it is called.
>
> However the getter() is always called.
>
> Neal
>
>> try Boolean.FALSE (Object) instead of false (which is a primitive
>> type).
>>
>> Regards,
>>
>>
>> PQ
>>
>> "This Guy Thinks He Knows Everything"
>> "This Guy Thinks He Knows What He Is Doing"
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: February 26, 2003 2:04 PM
>> To: [EMAIL PROTECTED]
>> Subject: RE: checkbox and iterate problem
>>
>> I have a Reset method, and I am calling  mFolders[i].setChecked(false)
>> for each item in my array. Is that what you mean by setting the
>> default value ?
>> If so, it hasn't fixed my problem.
>>
>> Thanx
>>
>>> Have to set default value in reset method.
>>>
>>> Regards,
>>>
>>>
>>> PQ
>>>
>>> "This Guy Thinks He Knows Everything"
>>> "This Guy Thinks He Knows What He Is Doing"
>>>
>>> -Original Message-
>>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>> Sent: February 26, 2003 1:18 PM
>>> To: [EMAIL PROTECTED]
>>> Subject: checkbox and iterate problem
>>>
>>> Hi,
>>>  I'm having a problem with checkboxes and I was hoping someone could
>>> help.
>>>
>>>  The short version is:
>>>when using  over an array of checkboxes, the
>>> setter
>>> method is not called after submit
>>>
>>>  Long version
>>>I have class   CheckableString { String str; boolean checked =
>>> false;
>>> // etc.. };
>>>I have a Form
>>>HostForm extends ActionForm {
>>>  CheckableString[] mFolders = new CheckableString[100];
>>> public CheckableString getFolder(int n) {
>>> System.err.println("HostForm getFolder a " + mFolders[n]);
>>> return mFolders[n];
>>> }
>>> public CheckableString[] getFolder() {
>>> System.err.println("HostForm getFolder b " + this);
>>> for (int i = 0; i != mFolders.length; i++) {
>>> System.err.println("HostForm getFolder b " +
>>> mFolders[i]);
>>> }
>>> return mFolders;
>>> }
>>> public void setFolder(int n, CheckableString folders) {
>>> System.err.println("HostForm setFolder a " + folders + " " +
>>> this);
>>> mFolders[n] = folders;
>>> }
>>> public void setFolder(CheckableString[] folders) {
>>> System.err.println("HostForm setFolder b " + this);
>>> mFolders = folders;
>>> }
>>> public void reset(ActionMapping a, HttpServletRequest b) {
>>> System.err.println("HostForm reset " + this);
>>> flag = false;
>>> for (int i = 0; i != mFolders.length; i++) {
>>> System.err.println("HostForm reset "
>>> + mFolders[i]);
>>> if (mFolders[i] != null)
>>>
>>> mFolders[i].setChecked(false);
>>> }
>>> }
>>> }
>>>
>>> I have an Action class setup the form, populating values from a
>>> database,
>>

RE: checkbox and iterate problem

2003-02-26 Thread pqin
Mine is Collection, so I iterate thru the collection and set "false"
(String) to each checked.

Regards,
 
 
PQ
 
"This Guy Thinks He Knows Everything"
"This Guy Thinks He Knows What He Is Doing"

-Original Message-
From: Neal [mailto:[EMAIL PROTECTED] 
Sent: February 26, 2003 5:20 PM
To: [EMAIL PROTECTED]
Subject: RE: checkbox and iterate problem

I changed everything from boolean (primative) to Boolean (Object type), no
difference
I still see the same behavior.
After submit my setter function is not called.
but for a non-indexed checkbox it is called.

However the getter() is always called.

Neal

> try Boolean.FALSE (Object) instead of false (which is a primitive type).
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: February 26, 2003 2:04 PM
> To: [EMAIL PROTECTED]
> Subject: RE: checkbox and iterate problem
>
> I have a Reset method, and I am calling  mFolders[i].setChecked(false)
> for each item in my array. Is that what you mean by setting the default
> value ?
> If so, it hasn't fixed my problem.
>
> Thanx
>
>> Have to set default value in reset method.
>>
>> Regards,
>>
>>
>> PQ
>>
>> "This Guy Thinks He Knows Everything"
>> "This Guy Thinks He Knows What He Is Doing"
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: February 26, 2003 1:18 PM
>> To: [EMAIL PROTECTED]
>> Subject: checkbox and iterate problem
>>
>> Hi,
>>  I'm having a problem with checkboxes and I was hoping someone could
>> help.
>>
>>  The short version is:
>>when using  over an array of checkboxes, the
>> setter
>> method is not called after submit
>>
>>  Long version
>>I have class   CheckableString { String str; boolean checked =
>> false;
>> // etc.. };
>>I have a Form
>>HostForm extends ActionForm {
>>  CheckableString[] mFolders = new CheckableString[100];
>>  public CheckableString getFolder(int n) {
>>  System.err.println("HostForm getFolder a " + mFolders[n]);
>>  return mFolders[n];
>>  }
>>  public CheckableString[] getFolder() {
>>  System.err.println("HostForm getFolder b " + this);
>>  for (int i = 0; i != mFolders.length; i++) {
>>  System.err.println("HostForm getFolder b " +
>> mFolders[i]);
>>  }
>>  return mFolders;
>>  }
>>  public void setFolder(int n, CheckableString folders) {
>>  System.err.println("HostForm setFolder a " + folders + " " +
>> this);
>>  mFolders[n] = folders;
>>  }
>>  public void setFolder(CheckableString[] folders) {
>>  System.err.println("HostForm setFolder b " + this);
>>  mFolders = folders;
>>  }
>>  public void reset(ActionMapping a, HttpServletRequest b) {
>>  System.err.println("HostForm reset " + this);
>>  flag = false;
>>  for (int i = 0; i != mFolders.length; i++) {
>>  System.err.println("HostForm reset "
>> + mFolders[i]);
>>  if (mFolders[i] != null)
>>
>> mFolders[i].setChecked(false);
>>  }
>>  }
>>  }
>>
>>  I have an Action class setup the form, populating values from a
>> database,
>> it then forwards to a jsp page
>> 
>> ..
>> > indexId="index">
>> 
>>   
>> 
>>> name='quack' />
>>   
>> 
>>   
>> 
>> 
>> 
>>
>>
>> The form is populated correctly, items marked as true are selected.
>> And looking at the logs the getter function is called
>> The problem is when I submit, the setter function is NEVER called, and
>> the Form is not populated.
>> note: If I have a simple non-indexed checkbox, then that works as
>> expected and the setter is called
>>
>> I am using struts 1.1RC1
>>
>> Anyone got any ideas ??, I'm stumped
>>
>> Thanks
>>
>> Neal
>>
>>
>>
>>
>>
>>
>> -
>> 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 and iterate problem

2003-02-26 Thread Neal
I changed everything from boolean (primative) to Boolean (Object type), no
difference
I still see the same behavior.
After submit my setter function is not called.
but for a non-indexed checkbox it is called.

However the getter() is always called.

Neal

> try Boolean.FALSE (Object) instead of false (which is a primitive type).
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: February 26, 2003 2:04 PM
> To: [EMAIL PROTECTED]
> Subject: RE: checkbox and iterate problem
>
> I have a Reset method, and I am calling  mFolders[i].setChecked(false)
> for each item in my array. Is that what you mean by setting the default
> value ?
> If so, it hasn't fixed my problem.
>
> Thanx
>
>> Have to set default value in reset method.
>>
>> Regards,
>>
>>
>> PQ
>>
>> "This Guy Thinks He Knows Everything"
>> "This Guy Thinks He Knows What He Is Doing"
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: February 26, 2003 1:18 PM
>> To: [EMAIL PROTECTED]
>> Subject: checkbox and iterate problem
>>
>> Hi,
>>  I'm having a problem with checkboxes and I was hoping someone could
>> help.
>>
>>  The short version is:
>>when using  over an array of checkboxes, the
>> setter
>> method is not called after submit
>>
>>  Long version
>>I have class   CheckableString { String str; boolean checked =
>> false;
>> // etc.. };
>>I have a Form
>>HostForm extends ActionForm {
>>  CheckableString[] mFolders = new CheckableString[100];
>>  public CheckableString getFolder(int n) {
>>  System.err.println("HostForm getFolder a " + mFolders[n]);
>>  return mFolders[n];
>>  }
>>  public CheckableString[] getFolder() {
>>  System.err.println("HostForm getFolder b " + this);
>>  for (int i = 0; i != mFolders.length; i++) {
>>  System.err.println("HostForm getFolder b " +
>> mFolders[i]);
>>  }
>>  return mFolders;
>>  }
>>  public void setFolder(int n, CheckableString folders) {
>>  System.err.println("HostForm setFolder a " + folders + " " +
>> this);
>>  mFolders[n] = folders;
>>  }
>>  public void setFolder(CheckableString[] folders) {
>>  System.err.println("HostForm setFolder b " + this);
>>  mFolders = folders;
>>  }
>>  public void reset(ActionMapping a, HttpServletRequest b) {
>>  System.err.println("HostForm reset " + this);
>>  flag = false;
>>  for (int i = 0; i != mFolders.length; i++) {
>>  System.err.println("HostForm reset "
>> + mFolders[i]);
>>  if (mFolders[i] != null)
>>
>> mFolders[i].setChecked(false);
>>  }
>>  }
>>  }
>>
>>  I have an Action class setup the form, populating values from a
>> database,
>> it then forwards to a jsp page
>> 
>> ..
>> > indexId="index">
>> 
>>   
>> 
>>> name='quack' />
>>   
>> 
>>   
>> 
>> 
>> 
>>
>>
>> The form is populated correctly, items marked as true are selected.
>> And looking at the logs the getter function is called
>> The problem is when I submit, the setter function is NEVER called, and
>> the Form is not populated.
>> note: If I have a simple non-indexed checkbox, then that works as
>> expected and the setter is called
>>
>> I am using struts 1.1RC1
>>
>> Anyone got any ideas ??, I'm stumped
>>
>> Thanks
>>
>> Neal
>>
>>
>>
>>
>>
>>
>> -
>> 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 and iterate problem

2003-02-26 Thread pqin
try Boolean.FALSE (Object) instead of false (which is a primitive type).

Regards,
 
 
PQ
 
"This Guy Thinks He Knows Everything"
"This Guy Thinks He Knows What He Is Doing"

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: February 26, 2003 2:04 PM
To: [EMAIL PROTECTED]
Subject: RE: checkbox and iterate problem

I have a Reset method, and I am calling  mFolders[i].setChecked(false) for
each item in my array. Is that what you mean by setting the default value
?
If so, it hasn't fixed my problem.

Thanx

> Have to set default value in reset method.
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: February 26, 2003 1:18 PM
> To: [EMAIL PROTECTED]
> Subject: checkbox and iterate problem
>
> Hi,
>  I'm having a problem with checkboxes and I was hoping someone could
> help.
>
>  The short version is:
>when using  over an array of checkboxes, the setter
> method is not called after submit
>
>  Long version
>I have class   CheckableString { String str; boolean checked = false;
> // etc.. };
>I have a Form
>HostForm extends ActionForm {
>  CheckableString[] mFolders = new CheckableString[100];
>   public CheckableString getFolder(int n) {
>   System.err.println("HostForm getFolder a " + mFolders[n]);
>   return mFolders[n];
>   }
>   public CheckableString[] getFolder() {
>   System.err.println("HostForm getFolder b " + this);
>   for (int i = 0; i != mFolders.length; i++) {
>   System.err.println("HostForm getFolder b " +
> mFolders[i]);
>   }
>   return mFolders;
>   }
>   public void setFolder(int n, CheckableString folders) {
>   System.err.println("HostForm setFolder a " + folders + " " +
> this);
>   mFolders[n] = folders;
>   }
>   public void setFolder(CheckableString[] folders) {
>   System.err.println("HostForm setFolder b " + this);
>   mFolders = folders;
>   }
>   public void reset(ActionMapping a, HttpServletRequest b) {
>   System.err.println("HostForm reset " + this);
>   flag = false;
>   for (int i = 0; i != mFolders.length; i++) {
>   System.err.println("HostForm reset "
> + mFolders[i]);
>   if (mFolders[i] != null)
>
> mFolders[i].setChecked(false);
>   }
>   }
>   }
>
>   I have an Action class setup the form, populating values from a
> database,
> it then forwards to a jsp page
> 
> ..
>  indexId="index">
> 
>   
> 
> name='quack' />
>   
> 
>   
> 
> 
> 
>
>
> The form is populated correctly, items marked as true are selected. And
> looking at the logs the getter function is called
> The problem is when I submit, the setter function is NEVER called, and
> the Form is not populated.
> note: If I have a simple non-indexed checkbox, then that works as
> expected and the setter is called
>
> I am using struts 1.1RC1
>
> Anyone got any ideas ??, I'm stumped
>
> Thanks
>
> Neal
>
>
>
>
>
>
> - 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 and iterate problem

2003-02-26 Thread nkstruts
I have a Reset method, and I am calling  mFolders[i].setChecked(false) for
each item in my array. Is that what you mean by setting the default value
?
If so, it hasn't fixed my problem.

Thanx

> Have to set default value in reset method.
>
> Regards,
>
>
> PQ
>
> "This Guy Thinks He Knows Everything"
> "This Guy Thinks He Knows What He Is Doing"
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: February 26, 2003 1:18 PM
> To: [EMAIL PROTECTED]
> Subject: checkbox and iterate problem
>
> Hi,
>  I'm having a problem with checkboxes and I was hoping someone could
> help.
>
>  The short version is:
>when using  over an array of checkboxes, the setter
> method is not called after submit
>
>  Long version
>I have class   CheckableString { String str; boolean checked = false;
> // etc.. };
>I have a Form
>HostForm extends ActionForm {
>  CheckableString[] mFolders = new CheckableString[100];
>   public CheckableString getFolder(int n) {
>   System.err.println("HostForm getFolder a " + mFolders[n]);
>   return mFolders[n];
>   }
>   public CheckableString[] getFolder() {
>   System.err.println("HostForm getFolder b " + this);
>   for (int i = 0; i != mFolders.length; i++) {
>   System.err.println("HostForm getFolder b " +
> mFolders[i]);
>   }
>   return mFolders;
>   }
>   public void setFolder(int n, CheckableString folders) {
>   System.err.println("HostForm setFolder a " + folders + " " +
> this);
>   mFolders[n] = folders;
>   }
>   public void setFolder(CheckableString[] folders) {
>   System.err.println("HostForm setFolder b " + this);
>   mFolders = folders;
>   }
>   public void reset(ActionMapping a, HttpServletRequest b) {
>   System.err.println("HostForm reset " + this);
>   flag = false;
>   for (int i = 0; i != mFolders.length; i++) {
>   System.err.println("HostForm reset "
> + mFolders[i]);
>   if (mFolders[i] != null)
>
> mFolders[i].setChecked(false);
>   }
>   }
>   }
>
>   I have an Action class setup the form, populating values from a
> database,
> it then forwards to a jsp page
> 
> ..
>  indexId="index">
> 
>   
> 
> name='quack' />
>   
> 
>   
> 
> 
> 
>
>
> The form is populated correctly, items marked as true are selected. And
> looking at the logs the getter function is called
> The problem is when I submit, the setter function is NEVER called, and
> the Form is not populated.
> note: If I have a simple non-indexed checkbox, then that works as
> expected and the setter is called
>
> I am using struts 1.1RC1
>
> Anyone got any ideas ??, I'm stumped
>
> Thanks
>
> Neal
>
>
>
>
>
>
> - 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 and iterate problem

2003-02-26 Thread pqin
Have to set default value in reset method.

Regards,
 
 
PQ
 
"This Guy Thinks He Knows Everything"
"This Guy Thinks He Knows What He Is Doing"

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: February 26, 2003 1:18 PM
To: [EMAIL PROTECTED]
Subject: checkbox and iterate problem

Hi,
 I'm having a problem with checkboxes and I was hoping someone could help.

 The short version is:
   when using  over an array of checkboxes, the setter
method is not called after submit

 Long version
   I have class   CheckableString { String str; boolean checked = false;
// etc.. };
   I have a Form
   HostForm extends ActionForm {
 CheckableString[] mFolders = new CheckableString[100];
public CheckableString getFolder(int n) {
System.err.println("HostForm getFolder a " + mFolders[n]);
return mFolders[n];
}
public CheckableString[] getFolder() {
System.err.println("HostForm getFolder b " + this);
for (int i = 0; i != mFolders.length; i++) {
System.err.println("HostForm getFolder b " +
mFolders[i]);
}
return mFolders;
}
public void setFolder(int n, CheckableString folders) {
System.err.println("HostForm setFolder a " + folders + " " +
this);
mFolders[n] = folders;
}
public void setFolder(CheckableString[] folders) {
System.err.println("HostForm setFolder b " + this);
mFolders = folders;
}
public void reset(ActionMapping a, HttpServletRequest b) {
System.err.println("HostForm reset " + this);
flag = false;
for (int i = 0; i != mFolders.length; i++) {
System.err.println("HostForm reset "
+ mFolders[i]);
if (mFolders[i] != null)

mFolders[i].setChecked(false);
}
}
}

I have an Action class setup the form, populating values from a
database,
it then forwards to a jsp page

..


  

   
  

  





The form is populated correctly, items marked as true are selected. And
looking at the logs the getter function is called
The problem is when I submit, the setter function is NEVER called, and the
Form is not populated.
note: If I have a simple non-indexed checkbox, then that works as expected
and the setter is called

I am using struts 1.1RC1

Anyone got any ideas ??, I'm stumped

Thanks

Neal






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