Thanks Vijay! I've verified the value returned by request.getParameterValues("denyCodes") even before sending out this mail. I don't have any clue on how to proceed further. I'll try debugging it more.
Thanks, Tarun. On 3/31/06, vijay venkataraman <[EMAIL PROTECTED]> wrote: > > Tarun, > If the value in being rendered is in string array pointed by the > property it will be rendered with checked attribute set. I know it works. > It is bit weired that the set method is not being called i am not able > to find what is happening. Do you see the values coming fine in the > HttpRequest? > If you debug and view your HttpRequest - If you have *selected* some > checkboxes then you should see a parameter by name denyCodes and to that > there will be a array containing the selected values in the array. Sorry > i am stuck with something deep and cannot probe any further now. Pulling > the bean util source code along with Struts source code and seeing what > happens will give you a clear idea. > > Vijay Venkataraman > > Tarun Reddy wrote: > > >Hi Vijay, > >Thanks for the reply! I had a look at the HTML source generated by JSP > page > >which contains multibox tag. Here are some sample entries, > > > ><form name="denyForm" method="post" action="/testingtool/deny.do"> > > <table> > > <tr align="center"> <input type="submit" value="Submit"></tr> > > <tr> <input type="checkbox" name="denyCodes" > >value="216">216</tr> > > <tr> <input type="checkbox" name="denyCodes" > >value="415">415</tr> > > <tr> <input type="checkbox" name="denyCodes" > value="05">05</tr> > > > >Let me tell you, <bean:write> tag nested in the <html:multibox> tag takes > >care of setting this value attirbute to the same as label. The HTML > source > >also proved that this problem is not related to setting value attribute. > >Second point is, yeah there's a slight confusion in the use of multibox > tag. > >In the specs they say that you can make ur checkboxes checked based on > the > >values present in, string array in the ActionForm. But can you tell me > >whether we can make selections among multiple checkboxes and then send > the > >values of the checked checkboxes to the Action class? I'm surprised to > see > >that the setter method was never called while submitting the form to the > >action class. Please suggest me. > > > > > >On 3/31/06, vijay venkataraman <[EMAIL PROTECTED]> wrote: > > > > > >>The struts doc goes like this : > >> > >>*Multibox:* > >>** > >> > >>Renders an HTML <input> element of type |checkbox|, whose "checked" > >>status is initialized based on whether the specified value matches one > >>of the elements of the underlying property's array of current values. > >>This element is useful when you have large numbers of checkboxes, and > >>prefer to combine the values into a single array-valued property instead > >>of multiple boolean properties. This tag is only valid when nested > >>inside a form tag body. > >> > >>*WARNING*: In order to correctly recognize cases where none of the > >>associated checkboxes are selected, the |ActionForm| bean associated > >>with this form must include a statement setting the corresponding *array > >>to zero length in the |reset()| method. > >>* > >> > >>See the rendered html and make sure that check boxes are rendered with > >>the correct name. > >>I don't see you setting any value to the value attribute of multibox. > >>It is the value you set that is posted back. > >> > >>I don't know much about bean and iteration tag. > >> > >>Regards, > >>Vijay Venkataraman > >> > >> > >>Tarun Reddy wrote: > >> > >> > >> > >>>Hi All, > >>>I've been wasting my time on one issue pertaining to <html:multibox> > tag. > >>>I'm writing a code which should generate multiple checkboxes > dynamically > >>> > >>> > >>on > >> > >> > >>>a JSP page. The JSP should send the checked checkboxes value to the > >>> > >>> > >>Action > >> > >> > >>>class. But it's not sending any values. I've tried many approaches like > >>>1)initialized all the elements in the String[] to "" in the reset() > >>> > >>> > >>method > >> > >> > >>>2)tried retrieving the checked values using String[] codes= > >>>request.getParameterValues("denyCodes"); > >>>None of the above methods worked for me. I'm using Weblogic 8.1 and > >>> > >>> > >>Struts > >> > >> > >>>1.2.8. I've tried with Struts 1.1 too. Here's my code. > >>>------------------- > >>>public class DenyForm extends ActionForm { > >>> private String[] denyCodes= new String[80]; > >>> public String[] getDenyCodes(){ > >>> return denyCodes; > >>> } > >>> public void setDenyCodes(String[] denycodes){ > >>> this.denyCodes = denycodes; > >>> } > >>> public void reset(ActionMapping mapping, HttpServletRequest request) > >>> > >>> > >>{ > >> > >> > >>> for(int i=0;i<80;i++){ > >>> denyCodes[i] = ""; > >>> } > >>> } > >>>} > >>>------------------------denycodes.jsp page is like this, > >>><html:form action="deny"> > >>> <table> > >>> <tr align="center"> <html:submit /></tr> > >>> <logic:iterate name="denialCodes" id="code"> > >>> <tr> > >>> <html:multibox property="denyCodes" > > >>> <bean:write name="code" /> > >>> </html:multibox><bean:write name="code"/> > >>> </tr> > >>> </logic:iterate> > >>> </table><br> > >>></html:form> > >>>---------------------------------------Action Class is > >>>public class DenyAction extends Action { > >>> public ActionForward execute(ActionMapping mapping, ActionForm form, > >>> HttpServletRequest request, HttpServletResponse response) > >>> > >>> > >>throws > >> > >> > >>>Exception{ > >>> > >>> HttpSession session = request.getSession(); > >>> DenyForm denyForm = (DenyForm)form; > >>> String[] codes = denyForm.getDenyCodes(); > >>>// String[] codes = request.getParameterValues("denyCodes"); > >>> log.debug("codes array length is:"+codes.length); > >>> session.setAttribute("denyCodes",codes); > >>> return mapping.findForward("success"); > >>> } > >>>} > >>>--------------------------------------------------struts-config.xmlentry > >>> > >>> > >>is > >> > >> > >>>like this > >>> > >>> <form-bean name="denyForm" type="tars.form.DenyForm" /> > >>> > >>> <action path="/deny" type="tars.action.DenyAction" > >>> > >>> > >>name="denyForm"> > >> > >> > >>> <forward name="success" path="/query.jsp" /> > >>> </action> > >>>------------------------------------------------------------------ > >>> > >>>codes.length is always returning 0 as the length. I've added some debug > >>>statements in the ActionForm's set method to see whether it's being > >>> > >>> > >>called > >> > >> > >>>or not. To my surprise it was never called. That's what baffling me. > This > >>> > >>> > >>is > >> > >> > >>>really urgent. I would really appreciate if someone could help me out. > >>> > >>>Thanks, > >>>Tarun. > >>> > >>> > >>> > >>> > >>------------------------------DISCLAIMER------------------------------ > >>This message is for the named person's use only. It may contain > >>confidential, proprietary or legally privileged information. No > >>confidentiality or privilege is waived or lost by any mistransmission. > >> > >>If you receive this message in error, please immediately delete it and > >>all copies of it from your system, destroy any hard copies of it and > >>notify the sender. You must not, directly or indirectly, use, disclose, > >>distribute, print, or copy any part of this message if you are not the > >>intended recipient. > >> > >>Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each > >>reserve the right to monitor all e-mail communications through its > >>networks. > >> > >>Any views expressed in this message are those of the > >>individual sender, except where the message states otherwise and the > >>sender is authorized to state them to be the views of any such entity. > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > >> > > > ------------------------------DISCLAIMER------------------------------ > This message is for the named person's use only. It may contain > confidential, proprietary or legally privileged information. No > confidentiality or privilege is waived or lost by any mistransmission. > > If you receive this message in error, please immediately delete it and > all copies of it from your system, destroy any hard copies of it and > notify the sender. You must not, directly or indirectly, use, disclose, > distribute, print, or copy any part of this message if you are not the > intended recipient. > > Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each > reserve the right to monitor all e-mail communications through its > networks. > > Any views expressed in this message are those of the > individual sender, except where the message states otherwise and the > sender is authorized to state them to be the views of any such entity. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >