Thanks Niali:
        Do you have any examples or pointers for writing reset  method of 
ActionForm ?
        Should checkbox attribute in question in my ActionForm be Boolean 
or it can be String type?
        Right now I have it as String and value coming from DAO are 
"Y"/"N" which I change it to "yes"/"no" before/after talking to form from 
Action.
        Thanks.
Digant







"Niall Pemberton" <[EMAIL PROTECTED]>
02/23/2006 09:14 PM
Please respond to "Struts Users Mailing List"

 
        To:     "Struts Users Mailing List" <user@struts.apache.org>
        cc: 
        Subject:        Re: checkbox member of form Bean doesn't pass/get value 
from my 
DispatchAction.


Browsers only transmit values when the checkbox is "checked" - in the 
reset
method of your ActionForm set the "lockedFlag" to the false value.

Niall

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
Sent: Thursday, February 23, 2006 9:22 PM


> I have problem with checkbox property not communicating with my Action.
> I have String property with "Y"/"N" in FormBean populated from DAO , I
> convert it to "yes"/"no" before sending it to form and I do conversion
> back from "yes"/"no" to "Y"/"N" after I receive from form and send it to
> DAO.
> What is missing here ?
> Pls. Help  !!
>
> In my FormBean it is String element
> as under
>
> public class InstrumentForm extends ActionForm {
> ....
> private String lockedFlag;
> ....
> }
>
>
>
> My jsp lines for checkbox is as follows:
>
>
>
> <td class="tdLabel"><fmt:message key="label.lockedFlag"/>:</td>
>                 <td><html:checkbox property="lockedFlag"
> value="${lockedFlag}"/></td>
>
>
>
>
>
> As my dao returns "Y" or "N"
>
> I do following conversion when I send data to form.
>
>
>     public ActionForward setUpForInsertOrUpdate(ActionMapping mapping,
> ActionForm form, HttpServletRequest request, HttpServletResponse 
response)
> throws Exception {
>
>         InstrumentForm instForm = (InstrumentForm)form;
>
>             if (instrument.getLockedFlag().equalsIgnoreCase("Y"))
>             {
>                 instrument.setLockedFlag("yes");
>             }
>             else
>             {
>                 instrument.setLockedFlag("no");
>             }
>             BeanUtils.copyProperties(instForm, instrument);
>         }
>         prep(request,initMap);
>         return mapping.findForward(Constants.SUCCESS);
> }
>
>
> On its way back from form I do following conversion
>
>  public ActionForward insertOrUpdate(ActionMapping mapping, ActionForm
> form, HttpServletRequest request,               HttpServletResponse
> response) throws Exception
> {
>         InstrumentForm instForm = (InstrumentForm)form;
>         if (instForm.getLockedFlag().equalsIgnoreCase("yes"))
>         {
>                 instForm.setLockedFlag("Y");
>         }
>         else
>         {
>                 instForm.setLockedFlag("N");
>         }
>         instService.updateInstrument(instrument);
> }



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





This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries 
and affiliates.

Reply via email to