RE: Struts Bug? My Bug? Help!! Please!

2001-07-20 Thread Becky Moyer

Thank you!
I forgot about that.  Thanks for jogging my memory.  I know I've read about 
that in the mailing list somewhere before, but I couldn't find it.  I 
appreciate your quick response.

Becky

Original Message Follows
From: "Abraham Kang" <[EMAIL PROTECTED]>
Reply-To: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: RE: Struts Bug?  My Bug? Help!! Please!
Date: Fri, 20 Jul 2001 14:07:44 -0700

Hi Becky,

Did you override the reset () method of ActionForm?  If you didn't you
need to set the Attribute of your ActionForm object that represents the
multibox to null.

Like:

 public void reset(ActionMapping mapping, HttpServletRequest request) {

 this.action = "Create";
 this.autoConnect = false;
 this.yourMultiboxNames = null;

 }

--Abraham

 > -Original Message-
 > From: Becky Moyer [mailto:[EMAIL PROTECTED]]
 > Sent: Friday, July 20, 2001 1:20 PM
 > To: [EMAIL PROTECTED]
 > Subject: Struts Bug? My Bug? Help!! Please!
 >
 >
 >I've got a multibox/iterate combination form.  My webapp works
 > when there
 > is something to submit.  When I check at least one value checked in my
 > multiboxes, I get the expected result.  When there is nothing
 > checked in my
 > multiboxes, my form object is the same as it was before I changed the
 > checkboxes.  For example, I'll have 4 checkboxes displayed,
 > representing 4
 > strings, String1, String2, String3, String4.  I will check String2, press
 > submit, and I receive the correct form in my ActionClass.  After updating
 > the form object and returning to my multibox page, if I uncheck
 > String2 and
 > submit, the form I receive contains String2 as being checked.
 >
 > My form contains 3 String arrays, one of which contains links,
 > one contains
 > the string names, and the other contains the string names which
 > are checked.
 >
 > I have done as much testing as I can, gone through my code, and
 > cannot find
 > a bug.  Is this a bug (or perhaps it is a "feature" ;-) ) of Struts?
 >
 > If this isn't enough info, I can send code.  What is going on?
 >
 > Thanks so much!
 > Becky
 >
 >
 > _
 > Get your FREE download of MSN Explorer at 
http://explorer.msn.com/intl.asp
 >
 >



_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




RE: Struts Bug? My Bug? Help!! Please!

2001-07-20 Thread Abraham Kang

Hi Becky,

   Did you override the reset () method of ActionForm?  If you didn't you
need to set the Attribute of your ActionForm object that represents the
multibox to null.

Like:

public void reset(ActionMapping mapping, HttpServletRequest request) {

this.action = "Create";
this.autoConnect = false;
this.yourMultiboxNames = null;

}

--Abraham

> -Original Message-
> From: Becky Moyer [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 20, 2001 1:20 PM
> To: [EMAIL PROTECTED]
> Subject: Struts Bug? My Bug? Help!! Please!
>
>
>I've got a multibox/iterate combination form.  My webapp works
> when there
> is something to submit.  When I check at least one value checked in my
> multiboxes, I get the expected result.  When there is nothing
> checked in my
> multiboxes, my form object is the same as it was before I changed the
> checkboxes.  For example, I'll have 4 checkboxes displayed,
> representing 4
> strings, String1, String2, String3, String4.  I will check String2, press
> submit, and I receive the correct form in my ActionClass.  After updating
> the form object and returning to my multibox page, if I uncheck
> String2 and
> submit, the form I receive contains String2 as being checked.
>
> My form contains 3 String arrays, one of which contains links,
> one contains
> the string names, and the other contains the string names which
> are checked.
>
> I have done as much testing as I can, gone through my code, and
> cannot find
> a bug.  Is this a bug (or perhaps it is a "feature" ;-) ) of Struts?
>
> If this isn't enough info, I can send code.  What is going on?
>
> Thanks so much!
> Becky
>
>
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>




RE: Struts Bug? My Bug? Help!! Please!

2001-07-20 Thread Becky Moyer

Here is a simplified overview of what you need to do.  If you still would 
like code, I can still supply you with it, but I think this will be easier 
to understand.

ActionForm:

2 fields with associated getter and setters:

String[] CheckboxNames

String[] CheckboxValues

You must populate this form before you hit the JSP to display it (if you 
want to preset the values).  So, figure out all the possible values, and 
then figure out what you want checked.  So, for example...

checkboxNames[0] = "String1";
checkboxNames[1] = "String2";
checkboxNames[2] = "String3";
checkboxNames[3] = "String4";

and

checkboxValues[0] = "String2";
checkboxValues[1] = "String4";

Then say

MyForm form = new MyForm();
form.setCheckboxNames(checkboxNames);
form.setCheckboxValues(checkboxValues);

And put the form in the session.

When you get to your jsp, retreive the form from the session, and place it 
into the page context:

pageContext.setAttribute("MyForm", myform , PageContext.PAGE_SCOPE);

Then, where you want the multiple checkboxes on your jsp, do the following:




  

  


  

  





   



THen when you press submit and go to your actionClass, you can compare 
CheckboxNames to CHeckboxValues to see what was checked.

Did that explain it enough?

Hope it helps,
Becky



Original Message Follows
From: Prashanth_Thm <[EMAIL PROTECTED]>
To: Becky Moyer <[EMAIL PROTECTED]>
Subject: RE: Struts Bug?  My Bug? Help!! Please!
Date: Fri, 20 Jul 2001 16:23:53 -0400

Hi,
can you send me the code?
Actually i want to get the checked strings in my Action class which
i am not
able toyour code would be helpful to me.
and let me try to help you also if possible.

Prashanth.


 > -Original Message-
 > From:Becky Moyer [SMTP:[EMAIL PROTECTED]]
 > Sent:Friday, July 20, 2001 1:20 PM
 > To:  [EMAIL PROTECTED]
 > Subject: Struts Bug?  My Bug? Help!! Please!
 >
 >I've got a multibox/iterate combination form.  My webapp works when
 > there
 > is something to submit.  When I check at least one value checked in my
 > multiboxes, I get the expected result.  When there is nothing checked in
 > my
 > multiboxes, my form object is the same as it was before I changed the
 > checkboxes.  For example, I'll have 4 checkboxes displayed, representing 
4
 >
 > strings, String1, String2, String3, String4.  I will check String2, press
 > submit, and I receive the correct form in my ActionClass.  After updating
 > the form object and returning to my multibox page, if I uncheck String2
 > and
 > submit, the form I receive contains String2 as being checked.
 >
 > My form contains 3 String arrays, one of which contains links, one
 > contains
 > the string names, and the other contains the string names which are
 > checked.
 >
 > I have done as much testing as I can, gone through my code, and cannot
 > find
 > a bug.  Is this a bug (or perhaps it is a "feature" ;-) ) of Struts?
 >
 > If this isn't enough info, I can send code.  What is going on?
 >
 > Thanks so much!
 > Becky
 >
 >
 > _
 > Get your FREE download of MSN Explorer at 
http://explorer.msn.com/intl.asp


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp