Using multibox to indicate checked value
Hi guys I have this ActionForm public class InterestsForm extends ActionForm { private String[] selectedItems = {}; private String[] items = {business,htech}; private String[] userPreviousSelectedItems= {business}; public String[] getSelectedItems() { return this.selectedItems; } public void setSelectedItems(String[] selectedItems) { this.selectedItems = selectedItems; } } And this form: logic:iterate indexId=counter name=interestFrom id=item property=items html:multibox property=selectedItems bean:write name=item / /html:multibox bean:message key=interests.bean:write name=item / / /logic:iterate I would like to check the items that the user checked previously and I stored them in userPreviousSelectedItems (I can also create a collection instead). How can I do it? Thanks Odelya - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Map based Struts Action Form and multibox Issue
I am using map based Struts action form Something like below... public FooForm extends ActionForm { private final Map values = new HashMap(); public void setValue(String key, Object value) { values.put(key, value); } public Object getValue(String key) { return values.get(key); } } In Jsp I have something like below Map based Form works well for others except multibox or select with multiple=true In setValue, The Object value always String and not String array that is what I expect for multibox or multiple select Since this is String, the form is selected with just one selection the first selection.. Please help -- View this message in context: http://www.nabble.com/Map-based-Struts-Action-Form-and-multibox-Issue-tp15623494p15623494.html Sent from the Struts - User mailing list archive at Nabble.com.
struts action form vs # of multibox fields determined at runtime
I have a jsp page that produces a matrix page based on database queries for both column header records and row records. The column and row crossed fields are displayed as multiboxes, i.e., each vertical column of those is a multibox field named as crossCheckBox0, crossCheckBox1, crossCheckBox2, ...starting from left to right. The number of those columns is determined at run time by database queries. If the number of fields is known at design time, then they can be added in to action form as String[] attibute, then one may take advantage of that struts would determine how many of the vertical boxes(rows) are checked at runtime. But now the number of mutlibox fields are dynamic and not design time determined, it is an unknown dimension array like crossCheckBox[#][#]...[#] where # stands for the number of rows being same. How to represent it in action form? Currently I have used javascript to loop thru the table to find out the each column's checked boxes and could not take advantage of struts multibox feature. Since I don't know how to add them into action form, I changed them into pure html input type=checkbox... field instead of html:multibox May anyone have experienced this issue before and would like to shed some light on it? I would appreciate a ton for the insight.
RE: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form
RequestProcessor is doing it's job by resetting the form. What should then happen is that your checkboxes should be set after reset() is called which doesn't seem to be happening. Somethings not right here, esp since when you comment out reset, it works. Can you post your code? pls. include the relevant parts of struts-config.xml, your action and your form. -Original Message- From: Garner Shawn [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 17:36 To: user@struts.apache.org Subject: RE: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form I am not explicitly calling the reset anywhere. I've also debugged it and can not find anything out of the ordinary. From I can tell it is the request processor that is resetting my form prior to the page displaying that ends up with the checkboxes not checked. Any help? Shawn -- From: Lance Semmens [EMAIL PROTECTED] To: 'Struts Users Mailing List' user@struts.apache.org Date: Tue, 14 Nov 2006 09:51:00 + Subject: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form The only thing I can think is maybe you're explicitly calling reset() in your action (instead of letting struts do it automatically). If not, I suggest putting a debug breakpoint on the setters for your checkboxes and see what's going on. - 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: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form
The only thing I can think is maybe you're explicitly calling reset() in your action (instead of letting struts do it automatically). If not, I suggest putting a debug breakpoint on the setters for your checkboxes and see what's going on. -Original Message- From: Garner Shawn [mailto:[EMAIL PROTECTED] Sent: 13 November 2006 20:19 To: user@struts.apache.org Subject: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form 1. Yes 2. Yes 3 In ActionForm.reset If I comment out my reset method then it populates the checkboxes based on the form values like I want however I then loose the ability to only get the checked value put into my action form after the page is submitted. From: Lance Semmens [EMAIL PROTECTED] To: 'Struts Users Mailing List' user@struts.apache.org Date: Mon, 13 Nov 2006 17:08:00 + Subject: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form A couple of things to check 1. Is your get action using the same form as your post action? 2. Do the names of the checkboxes in the html match your form? 3. Where are you resetting the checkboxes? I'm hoping you're doing it by overriding ActionForm.reset(). - 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: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form
I am not explicitly calling the reset anywhere. I've also debugged it and can not find anything out of the ordinary. From I can tell it is the request processor that is resetting my form prior to the page displaying that ends up with the checkboxes not checked. Any help? Shawn -- From: Lance Semmens [EMAIL PROTECTED] To: 'Struts Users Mailing List' user@struts.apache.org Date: Tue, 14 Nov 2006 09:51:00 + Subject: RE: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form The only thing I can think is maybe you're explicitly calling reset() in your action (instead of letting struts do it automatically). If not, I suggest putting a debug breakpoint on the setters for your checkboxes and see what's going on. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[HELP] struts 1.2.9 multibox/checkbox in session scoped form
I reset my checkboxes and a multibox in a form reset method but then when I come back to the page the values arn't checked. If I don't reset them then it won't register them as not checked anymore. How do I fix this? Shawn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form
A couple of things to check 1. Is your get action using the same form as your post action? 2. Do the names of the checkboxes in the html match your form? 3. Where are you resetting the checkboxes? I'm hoping you're doing it by overriding ActionForm.reset(). -Original Message- From: Garner Shawn [mailto:[EMAIL PROTECTED] Sent: 13 November 2006 16:47 To: user@struts.apache.org Subject: [HELP] struts 1.2.9 multibox/checkbox in session scoped form I reset my checkboxes and a multibox in a form reset method but then when I come back to the page the values arn't checked. If I don't reset them then it won't register them as not checked anymore. How do I fix this? Shawn - 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: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form
1. Yes 2. Yes 3 In ActionForm.reset If I comment out my reset method then it populates the checkboxes based on the form values like I want however I then loose the ability to only get the checked value put into my action form after the page is submitted. From: Lance Semmens [EMAIL PROTECTED] To: 'Struts Users Mailing List' user@struts.apache.org Date: Mon, 13 Nov 2006 17:08:00 + Subject: RE: [HELP] struts 1.2.9 multibox/checkbox in session scoped form A couple of things to check 1. Is your get action using the same form as your post action? 2. Do the names of the checkboxes in the html match your form? 3. Where are you resetting the checkboxes? I'm hoping you're doing it by overriding ActionForm.reset(). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: doubt with multibox
Yariel Ramos Moreno wrote: hello... I´m using html:multibox to generate a dynamic list of items... so far so good, but I have a problem because at the same time I generate a dynamic list too, but this list print always the same (example working)... then, what can I do if the second list always print the same and this is not the way html:multibox work?... example: My items: [] item 1 [] working [] item 2 [] working [] item 3 [] working [] item 4 [] working [] item n [] working I'm not sure I understand the question, but it sounds like you're not iterating your second list. You're probably missing an index expression. Post your JSP code if you can't get it figured out. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
doubt with multibox
hello... I´m using html:multibox to generate a dynamic list of items... so far so good, but I have a problem because at the same time I generate a dynamic list too, but this list print always the same (example working)... then, what can I do if the second list always print the same and this is not the way html:multibox work?... example: My items: [] item 1 [] working [] item 2 [] working [] item 3 [] working [] item 4 [] working [] item n [] working thanks!!! __ XIII Convención Científica de Ingeniería y Arquitectura 28/noviembre al 1/diciembre de 2006 Cujae, Ciudad de la Habana, Cuba http://www.cujae.edu.cu/eventos/convencion
Re: Check a multibox dynamically
Hi thre, I am trying to give you an example. Multibox basically fills in using a string array. i am sure you are aware of that. logic:iterate id=apprEntry name=listDevApprGrpList indexId=userIndex html:multibox property=toBeAddedList bean:write name=apprEntry property=userID/ /html:multibox/td /logic:iterate in the code toBeAddedList is the string array in the form bean that has the userID's of the selected users. So, when the check boxes are being checked , if the userID(bean:write name=apprEntry property=userID/) is present in the string array then the checkbox is checked. else no. And when you try to retrieve the array in the action form the string array contains all the userID's selected. in the action form you can set the array and the multibox is populated. toBeAddedList[i] = .getUserID(); you can even set the checkboxes in the Javascript function checkAllToBeAddedList() { for(var i=0; idocument.forms[0].toBeAddedList.length; i++) { document.forms[0].toBeAddedList[i].checked = true; } } I guess that would have been bad example if you already knew that you could set multibox and retireve them. In your logic, i guess in your actionForm you can prepare the string array based on the logic. you display the values from the database. the user makes a selection and submits the form, you compare that in the action form from the database and then preapre the string array and the appropriate checkboxes are checked. I hope that helps. Thanks Uday Karrothi On 10/3/06, grifoxx [EMAIL PROTECTED] wrote: Hi, I have a multibox tag that gets the labels and velues from the data base and I also have a bean that contains the data that the user choose. Now I want to check the boxes each time the user wants to update it's preferences. 1. I display the check boxes with the data comming from the data base 2. I want to compare those values whit the values that the user has 3. If there is a value equals to the value in the current multiboxes, check them Can anybody help me Thanks a lot -- View this message in context: http://www.nabble.com/Check-a-multibox-dynamically-tf2379274.html#a6630704 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Check a multibox dynamically
Hi, I have a multibox tag that gets the labels and velues from the data base and I also have a bean that contains the data that the user choose. Now I want to check the boxes each time the user wants to update it's preferences. 1. I display the check boxes with the data comming from the data base 2. I want to compare those values whit the values that the user has 3. If there is a value equals to the value in the current multiboxes, check them Can anybody help me Thanks a lot -- View this message in context: http://www.nabble.com/Check-a-multibox-dynamically-tf2379274.html#a6630704 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multibox not works when all checkboxes are unselected!
Thanks for this great explanations I already solved this problem and now 'm quite close to understand it! It would be great to have a sequence diagramm to see this flow submit-reset-populate-validate because knowing this flow isn't quite clear to a normal struts-user. THANKS A LOT starki78 wrote: Hi! I've a large problem with html:multibox. I've tree checkboxes. When I choose one or two or three it arrives correct at the next action! Only then all checkboxes are deselected it remembers the state of the checkboxes that was selected before! The state of the form is session in struts-config. Can you help me with this problem?? I really don't have an idea how to solve it! As Adam J. mentioned, it sounds like you're using a session-scoped bean. Try overriding (if you haven't already) the reset() method of your form bean and resetting the property: public void reset( ActionMapping mapping, HttpServletRequest request ) { this.values = new String[0]; } If you're _not_ using a session bean (and are using a request-scoped one instead), you'll _still_ want to do the above. Using this way in both cases, values from the previous request are discarded. If the web browser doesn't send any checkbox values over (because none are checked), then this.values will be an empty array, which corresponds to the very state of the submitted form's checkboxes (ie: none are checked). The array of values in your formbean for an html:multibox are a list of values of checked checkboxes. So... 1. Form bean looks like this: this.values = { value1, value3, value5 }; 2. Displayed form looks like this: html:multibox property=valuesvalue1/html:multibox 1 html:multibox property=valuesvalue2/html:multibox 2 html:multibox property=valuesvalue3/html:multibox 3 html:multibox property=valuesvalue4/html:multibox 4 html:multibox property=valuesvalue5/html:multibox 5 3. HTML sent to browser looks like this: input type=checkbox name=values value=value1 checked 1 input type=checkbox name=values value=value1 2 input type=checkbox name=values value=value1 checked 3 input type=checkbox name=values value=value1 4 input type=checkbox name=values value=value1 checked 5 4. User unchecks ALL checkboxes, and submits the form. 5. Struts calls reset() on your form - Your reset() method sets this.values = new String[0] 6. Struts populates your form, and _doesn't touch values_, because nothing is checked, so values remains an empty array. Sound good? - Scott - 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: multibox not works when all checkboxes are unselected!
I dont' have such a sequence like that, but you can get the same when you read the source code of the RequestProcessor class. starki78 wrote: Thanks for this great explanations I already solved this problem and now 'm quite close to understand it! It would be great to have a sequence diagramm to see this flow submit-reset-populate-validate because knowing this flow isn't quite clear to a normal struts-user. THANKS A LOT starki78 wrote: Hi! I've a large problem with html:multibox. I've tree checkboxes. When I choose one or two or three it arrives correct at the next action! Only then all checkboxes are deselected it remembers the state of the checkboxes that was selected before! The state of the form is session in struts-config. Can you help me with this problem?? I really don't have an idea how to solve it! As Adam J. mentioned, it sounds like you're using a session-scoped bean. Try overriding (if you haven't already) the reset() method of your form bean and resetting the property: public void reset( ActionMapping mapping, HttpServletRequest request ) { this.values = new String[0]; } If you're _not_ using a session bean (and are using a request-scoped one instead), you'll _still_ want to do the above. Using this way in both cases, values from the previous request are discarded. If the web browser doesn't send any checkbox values over (because none are checked), then this.values will be an empty array, which corresponds to the very state of the submitted form's checkboxes (ie: none are checked). The array of values in your formbean for an html:multibox are a list of values of checked checkboxes. So... 1. Form bean looks like this: this.values = { value1, value3, value5 }; 2. Displayed form looks like this: html:multibox property=valuesvalue1/html:multibox 1 html:multibox property=valuesvalue2/html:multibox 2 html:multibox property=valuesvalue3/html:multibox 3 html:multibox property=valuesvalue4/html:multibox 4 html:multibox property=valuesvalue5/html:multibox 5 3. HTML sent to browser looks like this: input type=checkbox name=values value=value1 checked 1 input type=checkbox name=values value=value1 2 input type=checkbox name=values value=value1 checked 3 input type=checkbox name=values value=value1 4 input type=checkbox name=values value=value1 checked 5 4. User unchecks ALL checkboxes, and submits the form. 5. Struts calls reset() on your form - Your reset() method sets this.values = new String[0] 6. Struts populates your form, and _doesn't touch values_, because nothing is checked, so values remains an empty array. Sound good? - Scott - 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]
multibox not works when all checkboxes are unselected!
Hi! I've a large problem with html:multibox. I've tree checkboxes. When I choose one or two or three it arrives correct at the next action! Only then all checkboxes are deselected it remembers the state of the checkboxes that was selected before! The state of the form is session in struts-config. Can you help me with this problem?? I really don't have an idea how to solve it! Thanks a lot! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: multibox not works when all checkboxes are unselected!
Browsers are only required to submit values for checkboxes when they are selected. So when a box is not checked, no value is sent, so the state on the server is not changed. When using session scoped objects to store the value of checkboxes your processing needs to be aware of the fact that values for checkbox=off are not sent. -Adam -Original Message- From: starki78 [mailto:[EMAIL PROTECTED] Sent: Thursday, June 08, 2006 11:40 AM To: user Subject: multibox not works when all checkboxes are unselected! Hi! I've a large problem with html:multibox. I've tree checkboxes. When I choose one or two or three it arrives correct at the next action! Only then all checkboxes are deselected it remembers the state of the checkboxes that was selected before! The state of the form is session in struts-config. Can you help me with this problem?? I really don't have an idea how to solve it! Thanks a lot! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - The information contained in this message may be privileged, confidential, and protected from disclosure. If the reader of this message is not the intended recipient, or any employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Paychex, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: multibox not works when all checkboxes are unselected!
Hi Adam I just tried: public void reset(ActionMapping mapping, HttpServletRequest request) { multiboxvalues = new String[3]; multiboxvalues[0] = ; multiboxvalues[1] = ; multiboxvalues[2] = ; } And now the problem seems to be solved but to be honest I don't have the knowledge to understand it! Thanks for you advice! Browsers are only required to submit values for checkboxes when they are selected. So when a box is not checked, no value is sent, so the state on the server is not changed. When using session scoped objects to store the value of checkboxes your processing needs to be aware of the fact that values for checkbox=off are not sent. -Adam -Original Message- From: starki78 [mailto:[EMAIL PROTECTED] Sent: Thursday, June 08, 2006 11:40 AM To: user Subject: multibox not works when all checkboxes are unselected! Hi! I've a large problem with html:multibox. I've tree checkboxes. When I choose one or two or three it arrives correct at the next action! Only then all checkboxes are deselected it remembers the state of the checkboxes that was selected before! The state of the form is session in struts-config. Can you help me with this problem?? I really don't have an idea how to solve it! Thanks a lot! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - The information contained in this message may be privileged, confidential, and protected from disclosure. If the reader of this message is not the intended recipient, or any employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Paychex, Inc. - 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: multibox not works when all checkboxes are unselected!
starki78 wrote: Hi! I've a large problem with html:multibox. I've tree checkboxes. When I choose one or two or three it arrives correct at the next action! Only then all checkboxes are deselected it remembers the state of the checkboxes that was selected before! The state of the form is session in struts-config. Can you help me with this problem?? I really don't have an idea how to solve it! As Adam J. mentioned, it sounds like you're using a session-scoped bean. Try overriding (if you haven't already) the reset() method of your form bean and resetting the property: public void reset( ActionMapping mapping, HttpServletRequest request ) { this.values = new String[0]; } If you're _not_ using a session bean (and are using a request-scoped one instead), you'll _still_ want to do the above. Using this way in both cases, values from the previous request are discarded. If the web browser doesn't send any checkbox values over (because none are checked), then this.values will be an empty array, which corresponds to the very state of the submitted form's checkboxes (ie: none are checked). The array of values in your formbean for an html:multibox are a list of values of checked checkboxes. So... 1. Form bean looks like this: this.values = { value1, value3, value5 }; 2. Displayed form looks like this: html:multibox property=valuesvalue1/html:multibox 1 html:multibox property=valuesvalue2/html:multibox 2 html:multibox property=valuesvalue3/html:multibox 3 html:multibox property=valuesvalue4/html:multibox 4 html:multibox property=valuesvalue5/html:multibox 5 3. HTML sent to browser looks like this: input type=checkbox name=values value=value1 checked 1 input type=checkbox name=values value=value1 2 input type=checkbox name=values value=value1 checked 3 input type=checkbox name=values value=value1 4 input type=checkbox name=values value=value1 checked 5 4. User unchecks ALL checkboxes, and submits the form. 5. Struts calls reset() on your form - Your reset() method sets this.values = new String[0] 6. Struts populates your form, and _doesn't touch values_, because nothing is checked, so values remains an empty array. Sound good? - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I insert a value from an id-iterate-bean into the value-tag of multibox?
Andreas Hartmann wrote: Hello Tarun, Tarun Reddy wrote: Hi, You can do this way, logic:iterate name=Portal property=deaktserver id=srv html:multibox property=inaktmachines bean:write name=srv / /html:multibox /logic:iterate This should work. This produces an Unterminated lt;html:multibox tag. You sure you aren't missing the /html:multibox ? Double check your typing. Btw: the property deaktserver resolves to a get/setDeaktserver() which gets or sets an ArrayList String. I'm fairly certain your backing form bean property needs to be an array (String[] typically) and not a List for a multibox. (I might be wrong, though, but try changing it to String[] just to see.) -- Rick http://www.learntechnology.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I insert a value from an id-iterate-bean into the value-tag of multibox?
Hello Rick, Rick Reumann wrote: Andreas Hartmann wrote: Hello Tarun, Tarun Reddy wrote: Hi, You can do this way, logic:iterate name=Portal property=deaktserver id=srv html:multibox property=inaktmachines bean:write name=srv / /html:multibox /logic:iterate This should work. This produces an Unterminated lt;html:multibox tag. You sure you aren't missing the /html:multibox ? Double check your typing. My fault :-(. I didn't recognize the closing after the property-value. Now, it's working fine. Thank you to both, Tarun and Rick, for your great help! Is the component bean:write name=srv / above used as nested body content of the html:multibox tag? Btw: the property deaktserver resolves to a get/setDeaktserver() which gets or sets an ArrayList String. I'm fairly certain your backing form bean property needs to be an array (String[] typically) and not a List for a multibox. (I might be wrong, though, but try changing it to String[] just to see.) The get-/setDeaktserver backing form is used in the iterate-tag. The backing form for the multibox is inaktmachines, which is an Array String. Kind regards, Andreas Hartmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do I insert a value from an id-iterate-bean into the value-tag of multibox?
Hello! I've got in a jsp the following code: logic:iterate name=Portal property=deaktserver id=srv html:multibox property=inaktmachines value='%= srv %' / /logic:iterate - This does not work. srv contains a string which I want to have as value of html:multibox. How should it be written? I would be glad to get a hint! Kind regards, Andreas Hartmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I insert a value from an id-iterate-bean into the value-tag of multibox?
Hi, You can do this way, logic:iterate name=Portal property=deaktserver id=srv html:multibox property=inaktmachines bean:write name=srv / /html:multibox /logic:iterate This should work. On 5/5/06, Andreas Hartmann [EMAIL PROTECTED] wrote: Hello! I've got in a jsp the following code: logic:iterate name=Portal property=deaktserver id=srv html:multibox property=inaktmachines value='%= srv %' / /logic:iterate - This does not work. srv contains a string which I want to have as value of html:multibox. How should it be written? I would be glad to get a hint! Kind regards, Andreas Hartmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I insert a value from an id-iterate-bean into the value-tag of multibox?
Hello Tarun, Tarun Reddy wrote: Hi, You can do this way, logic:iterate name=Portal property=deaktserver id=srv html:multibox property=inaktmachines bean:write name=srv / /html:multibox /logic:iterate This should work. This produces an Unterminated lt;html:multibox tag. Btw: the property deaktserver resolves to a get/setDeaktserver() which gets or sets an ArrayList String. Is there another way to do it? Kind regards, Andreas Hartmann On 5/5/06, Andreas Hartmann [EMAIL PROTECTED] wrote: Hello! I've got in a jsp the following code: logic:iterate name=Portal property=deaktserver id=srv html:multibox property=inaktmachines value='%= srv %' / /logic:iterate - This does not work. srv contains a string which I want to have as value of html:multibox. How should it be written? I would be glad to get a hint! Kind regards, Andreas Hartmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Ignorant multibox question.
Actually I got it to work elegantly with the following code: c:forEach items=${myForm.groups} var=groups trtd html-el:multibox property=chosenGroups value=${groups}/ c:out value=${groups}/ br/ /td/tr /c:forEach But thanks for the link anywaysI will use it in the future. Have you stumbled on this link: http://husted.com/struts/tips/007.html I think it's almost verbatim out of the Struts in Action Book hth, On 11/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Lets say I have the following multibox: table c:forEach items=${myForm.groups} var=groups trtd html-el:multibox property=groups value=${groups.groupName}/ c:out value=${groups.groupName}/ br/ /td/tr /c:forEach /table I have a List of POJOs with a name and a boolean value for each POJO. I want to change the boolean value to true if a user check marks a specific item in the List. If I wasn't in struts I could easily do this if I were using a Servlet. But how and where do I read through each POJO in the List changing the POJO instance variable to true if someone check marks it? -- Keith Sader [EMAIL PROTECTED] http://www.saderfamily.org/roller/page/ksader http://www.jroller.com/page/certifieddanger - 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]
Ignorant multibox question.
Lets say I have the following multibox: table c:forEach items=${myForm.groups} var=groups trtd html-el:multibox property=groups value=${groups.groupName}/ c:out value=${groups.groupName}/ br/ /td/tr /c:forEach /table I have a List of POJOs with a name and a boolean value for each POJO. I want to change the boolean value to true if a user check marks a specific item in the List. If I wasn't in struts I could easily do this if I were using a Servlet. But how and where do I read through each POJO in the List changing the POJO instance variable to true if someone check marks it? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ignorant multibox question.
Have you stumbled on this link: http://husted.com/struts/tips/007.html I think it's almost verbatim out of the Struts in Action Book hth, On 11/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Lets say I have the following multibox: table c:forEach items=${myForm.groups} var=groups trtd html-el:multibox property=groups value=${groups.groupName}/ c:out value=${groups.groupName}/ br/ /td/tr /c:forEach /table I have a List of POJOs with a name and a boolean value for each POJO. I want to change the boolean value to true if a user check marks a specific item in the List. If I wasn't in struts I could easily do this if I were using a Servlet. But how and where do I read through each POJO in the List changing the POJO instance variable to true if someone check marks it? -- Keith Sader [EMAIL PROTECTED] http://www.saderfamily.org/roller/page/ksader http://www.jroller.com/page/certifieddanger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
scrollbar vs multibox
hi, I have a div on autoscroll that contains multibox. Here's the code div id=motUrlLst class=motLst logic:iterate id=mot name=PandoraForm property=motTreeMap nbsp; html:multibox property=motSelectLst style=width: 10px;height: 10px onclick=autoPostBack('motSelectLst;' + this.value); bean:write name=mot property=key/ /html:multibox span class=mot onclick='remplirChampsMot(bean:write name=mot property=key/)' bean:write name=mot property=value filter=false/ /spanbr/ /logic:iterate /div It works fine when the vertical scroll bar is needed but instead of applying the horizontal, the text change line which is annoying. Any idea how the problem could be solved? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] scrollbar vs multibox
Eric Plante wrote: hi, I have a div on autoscroll that contains multibox. Here's the code div id=motUrlLst class=motLst logic:iterate id=mot name=PandoraForm property=motTreeMap nbsp; html:multibox property=motSelectLst style=width: 10px;height: 10px onclick=autoPostBack('motSelectLst;' + this.value); bean:write name=mot property=key/ /html:multibox span class=mot onclick='remplirChampsMot(bean:write name=mot property=key/)' bean:write name=mot property=value filter=false/ /spanbr/ /logic:iterate /div It works fine when the vertical scroll bar is needed but instead of applying the horizontal, the text change line which is annoying. Any idea how the problem could be solved? Thanks This is nothing to do with Struts, it's just how the HTML render model works. I'm sure there are other solutions, but the two I'd look at to start would be setting nowrap or minwidth on the div in its CSS rules. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] scrollbar vs multibox
Thanks, it worked. Sorry of the out of topic post. Eric Plante wrote: hi, I have a div on autoscroll that contains multibox. Here's the code div id=motUrlLst class=motLst logic:iterate id=mot name=PandoraForm property=motTreeMap nbsp; html:multibox property=motSelectLst style=width: 10px;height: 10px onclick=autoPostBack('motSelectLst;' + this.value); bean:write name=mot property=key/ /html:multibox span class=mot onclick='remplirChampsMot(bean:write name=mot property=key/)' bean:write name=mot property=value filter=false/ /spanbr/ /logic:iterate /div It works fine when the vertical scroll bar is needed but instead of applying the horizontal, the text change line which is annoying. Any idea how the problem could be solved? Thanks This is nothing to do with Struts, it's just how the HTML render model works. I'm sure there are other solutions, but the two I'd look at to start would be setting nowrap or minwidth on the div in its CSS rules. L. - 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: multibox error
Is that table inside a html:form? Chris Pat wrote: Hello I am using TC5.5.9,JSTL1.1,Struts1.2 With this code: table width=476 height=110 border=1 tr tdnbsp;/td tdhtml:multibox property=strArray value=Value1//td tdnbsp;/td /tr tr tdnbsp;/td tdnbsp;/td tdnbsp;/td /tr /table I have made sure my actionForm has the s/getter for checkbox1, checkbox2 strArray. Made sure the reset is setting the booleans to false. The page comes up without the html:multibox tag, so everything else is correct. Except for the error below. It seems like a tag library issue. Any and all insight welcomed. tia. I am getting javax.servlet.ServletException: Cannot find bean under name org.apache.struts.taglib.html.BEAN org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.jsp2_jsp._jspService(org.apache.jsp.jsp2_jsp:107) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN org.apache.struts.taglib.html.MultiboxTag.doEndTag(MultiboxTag.java:195) org.apache.jsp.jsp2_jsp._jspx_meth_html_multibox_0(org.apache.jsp.jsp2_jsp:125) org.apache.jsp.jsp2_jsp._jspService(org.apache.jsp.jsp2_jsp:88) __ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multibox error
is your form mapping correct in struts-config??? On 10/29/05, Chris Pat [EMAIL PROTECTED] wrote: Hello I am using TC5.5.9,JSTL1.1,Struts1.2 With this code: table width=476 height=110 border=1 tr td/td tdhtml:multibox property=strArray value=Value1//td td/td /tr tr td/td td/td td/td /tr /table I have made sure my actionForm has the s/getter for checkbox1, checkbox2 strArray. Made sure the reset is setting the booleans to false. The page comes up without the html:multibox tag, so everything else is correct. Except for the error below. It seems like a tag library issue. Any and all insight welcomed. tia. I am getting javax.servlet.ServletException: Cannot find bean under name org.apache.struts.taglib.html.BEAN org.apache.jasper.runtime.PageContextImpl.doHandlePageException( PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException( PageContextImpl.java:781) org.apache.jsp.jsp2_jsp._jspService(org.apache.jsp.jsp2_jsp:107) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java :322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN org.apache.struts.taglib.html.MultiboxTag.doEndTag(MultiboxTag.java:195) org.apache.jsp.jsp2_jsp._jspx_meth_html_multibox_0( org.apache.jsp.jsp2_jsp:125) org.apache.jsp.jsp2_jsp._jspService(org.apache.jsp.jsp2_jsp:88) __ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multibox error
Hello I am using TC5.5.9,JSTL1.1,Struts1.2 With this code: table width=476 height=110 border=1 tr tdnbsp;/td tdhtml:multibox property=strArray value=Value1//td tdnbsp;/td /tr tr tdnbsp;/td tdnbsp;/td tdnbsp;/td /tr /table I have made sure my actionForm has the s/getter for checkbox1, checkbox2 strArray. Made sure the reset is setting the booleans to false. The page comes up without the html:multibox tag, so everything else is correct. Except for the error below. It seems like a tag library issue. Any and all insight welcomed. tia. I am getting javax.servlet.ServletException: Cannot find bean under name org.apache.struts.taglib.html.BEAN org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.jsp2_jsp._jspService(org.apache.jsp.jsp2_jsp:107) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN org.apache.struts.taglib.html.MultiboxTag.doEndTag(MultiboxTag.java:195) org.apache.jsp.jsp2_jsp._jspx_meth_html_multibox_0(org.apache.jsp.jsp2_jsp:125) org.apache.jsp.jsp2_jsp._jspService(org.apache.jsp.jsp2_jsp:88) __ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multibox problem
Code where i put the values back: map.put(districtIds, stringArr); where stringArr is an array of what the user selected. - This is not the same as calling setDistrictIds. You need to call setDistrictIds(stringArr) explicitly.
RE: Multibox problem
Hi- Thanks for the response. The map is in helper class and i dont want my helper class to know anything about struts or actionForm. Thanks, Shyam Apte, Dhanashree (Noblestar) [EMAIL PROTECTED] 07/06/2005 11:45 AM Please respond to Struts Users Mailing List To: 'Struts Users Mailing List' user@struts.apache.org cc: Subject:RE: Multibox problem Code where i put the values back: map.put(districtIds, stringArr); where stringArr is an array of what the user selected. - This is not the same as calling setDistrictIds. You need to call setDistrictIds(stringArr) explicitly.
Multibox
Hi, Can anyone let me know how to automatically check checkboxes? Below is my current code: html:multibox property=selectedModules bean:write name=row property=id/ /html:multibox This is one of the many ways I've tried to get it to work: html:multibox property=selectedModules property=${row.id} {some Boolean equation} /html:multibox Cheers for you help! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multibox
From: Ben Taylor [EMAIL PROTECTED] Can anyone let me know how to automatically check checkboxes? Set the underlying form property and the framework will automatically render checked checkboxes. I have: c:forEach items=${accountMap} var=item html-el:multibox property=accounts value=${item.key}/ c:out value=${item.key}/ c:out value=${item.value.costCenterDesc}/ /c:forEach The form property accounts is a String[] containing account numbers. So this displays all of the accounts in accountMap, and 'checks' the boxes next to the ones that match the values in the accounts form property. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multibox
The multibox is bound to the selectedModule property of your form. Prior to displaying the page, populate selectedModule property of the form with its corresponding row.id values. When html:multibox .../ is invoked on the page, it will recongize the relationship and render the checkboxes as checked. /robert Ben Taylor wrote: Hi, Can anyone let me know how to automatically check checkboxes? Below is my current code: html:multibox property=selectedModules bean:write name=row property=id/ /html:multibox This is one of the many ways I've tried to get it to work: html:multibox property=selectedModules property=${row.id} {some Boolean equation} /html:multibox Cheers for you help! - 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: Multibox
Cheers, I've manged to get the ticks appearing now... However although they load fine on the first load they do not move after that. i.e. I can change which ones are selected and it'll go off and update the db but when I load the page again the origonal ticks are still shown. I've tried calling setting the String[] to null as well as each value to false but nothing seems to work :o( On Sat, 19 Mar 2005 18:51:30 -0500, Robert Taylor [EMAIL PROTECTED] wrote: The multibox is bound to the selectedModule property of your form. Prior to displaying the page, populate selectedModule property of the form with its corresponding row.id values. When html:multibox .../ is invoked on the page, it will recongize the relationship and render the checkboxes as checked. /robert Ben Taylor wrote: Hi, Can anyone let me know how to automatically check checkboxes? Below is my current code: html:multibox property=selectedModules bean:write name=row property=id/ /html:multibox This is one of the many ways I've tried to get it to work: html:multibox property=selectedModules property=${row.id} {some Boolean equation} /html:multibox Cheers for you help! - 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: Multibox
Ben Taylor wrote: Cheers, I've manged to get the ticks appearing now... However although they load fine on the first load they do not move after that. i.e. I can change which ones are selected and it'll go off and update the db but when I load the page again the origonal ticks are still shown. One reason could be that you defined the accompanying form with scope=session. If so, are you sure you need this? Then again, it could be that a method is pre-populating the checkboxes by retrieving the relevant values from the database that you just inserted. Can you post more code? Vamsee. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: map-backed forms with multibox/multiselect lists?
The good news is that this DOES work. I simply declared my methods to be public void setFoo(String key, String[] foos) { ... } public String[] getFoo(String key) { ... } and everything works fine. It took a detour through the Struts source (and ultimately from there through the beanutils source) to figure this out, but the problem was essentially that when doing the bean introspection, the beanutils first finds the getFoo() method and stores its return type. It then looks for a setFoo() method with the same argument type as the return type of getFoo(). If you try to return foo as an Object, it just won't work -- your setter won't be found and the method will never be called. thanks for the input, Mike -Original Message- From: Radu Badita [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 11:10 AM To: Struts Users Mailing List Subject: RE: map-backed forms with multibox/multiselect lists? I had the same problem some time ago (the solution vaguely suggested by Jack wouldn't had been an option since the properties were dynamic so I needed the key to distinguish between them). I asked on this list for help at that time, but didn't got an answer, so I guess nobody succeeded in doing something like this. Therefore I had to find some other solution to my problem... I'm guessing this might be some sort of a problem with commons-binutils (although public void setFoos(String key, String[] foos) isn't a valid javabeans setter so maybe it's just a bit out of it's scope). At 16:44 07.03.2005, you wrote: This works fine for list-backed form items (which we also use) but in this case I need something like public void setFoos(String key, String[] foos) is this possible? There are several workarounds I can think of, but this appears to be the cleanest solution if I can make it work. Mike -Original Message- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 9:42 AM To: Struts Users Mailing List Subject: Re: map-backed forms with multibox/multiselect lists? public void setFoos(String [] foos) On Fri, 4 Mar 2005 18:55:53 + (UTC), Mike Nidel [EMAIL PROTECTED] wrote: I'm trying to build a form element that combines the features of a map-backed property with a multibox (and the same for a multiple-selection list). I've made multiboxes work fine without the map-backed element, but I can't seem to get this to work. I've tried various method signatures in my form bean, but to no avail. For example, for a field called foo I have tried the following: public void setFoo(String key, Object val) { ... } or public void setFoo(String key, String[] val) { ... } I'm using a set of checkboxes on the JSP which should result in a list of the values of whichever boxes are selected. I can think of a number of javascript workarounds, as well as workarounds in my Action that go directly to the request parameters... but all of those are kludges and it seems like there should be a way to have multiple checkboxes that all reference a map-backed form property. Any thoughts? thanks a bunch, Mike Nidel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: map-backed forms with multibox/multiselect lists?
That's great! Thanks for sharing. Next time I'll know how to do it. Luckily you proved to be more determined and finally solved it. Congratulations! Nidel, Mike wrote: The good news is that this DOES work. I simply declared my methods to be public void setFoo(String key, String[] foos) { ... } public String[] getFoo(String key) { ... } and everything works fine. It took a detour through the Struts source (and ultimately from there through the beanutils source) to figure this out, but the problem was essentially that when doing the bean introspection, the beanutils first finds the getFoo() method and stores its return type. It then looks for a setFoo() method with the same argument type as the return type of getFoo(). If you try to return foo as an Object, it just won't work -- your setter won't be found and the method will never be called. thanks for the input, Mike -Original Message- From: Radu Badita [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 11:10 AM To: Struts Users Mailing List Subject: RE: map-backed forms with multibox/multiselect lists? I had the same problem some time ago (the solution vaguely suggested by Jack wouldn't had been an option since the properties were dynamic so I needed the key to distinguish between them). I asked on this list for help at that time, but didn't got an answer, so I guess nobody succeeded in doing something like this. Therefore I had to find some other solution to my problem... I'm guessing this might be some sort of a problem with commons-binutils (although public void setFoos(String key, String[] foos) isn't a valid javabeans setter so maybe it's just a bit out of it's scope). At 16:44 07.03.2005, you wrote: This works fine for list-backed form items (which we also use) but in this case I need something like public void setFoos(String key, String[] foos) is this possible? There are several workarounds I can think of, but this appears to be the cleanest solution if I can make it work. Mike -Original Message- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 9:42 AM To: Struts Users Mailing List Subject: Re: map-backed forms with multibox/multiselect lists? public void setFoos(String [] foos) On Fri, 4 Mar 2005 18:55:53 + (UTC), Mike Nidel [EMAIL PROTECTED] wrote: I'm trying to build a form element that combines the features of a map-backed property with a multibox (and the same for a multiple-selection list). I've made multiboxes work fine without the map-backed element, but I can't seem to get this to work. I've tried various method signatures in my form bean, but to no avail. For example, for a field called foo I have tried the following: public void setFoo(String key, Object val) { ... } or public void setFoo(String key, String[] val) { ... } I'm using a set of checkboxes on the JSP which should result in a list of the values of whichever boxes are selected. I can think of a number of javascript workarounds, as well as workarounds in my Action that go directly to the request parameters... but all of those are kludges and it seems like there should be a way to have multiple checkboxes that all reference a map-backed form property. Any thoughts? thanks a bunch, Mike Nidel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - 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] - 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]
map-backed forms with multibox/multiselect lists?
I'm trying to build a form element that combines the features of a map-backed property with a multibox (and the same for a multiple-selection list). I've made multiboxes work fine without the map-backed element, but I can't seem to get this to work. I've tried various method signatures in my form bean, but to no avail. For example, for a field called foo I have tried the following: public void setFoo(String key, Object val) { ... } or public void setFoo(String key, String[] val) { ... } I'm using a set of checkboxes on the JSP which should result in a list of the values of whichever boxes are selected. I can think of a number of javascript workarounds, as well as workarounds in my Action that go directly to the request parameters... but all of those are kludges and it seems like there should be a way to have multiple checkboxes that all reference a map-backed form property. Any thoughts? thanks a bunch, Mike Nidel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: map-backed forms with multibox/multiselect lists?
public void setFoos(String [] foos) On Fri, 4 Mar 2005 18:55:53 + (UTC), Mike Nidel [EMAIL PROTECTED] wrote: I'm trying to build a form element that combines the features of a map-backed property with a multibox (and the same for a multiple-selection list). I've made multiboxes work fine without the map-backed element, but I can't seem to get this to work. I've tried various method signatures in my form bean, but to no avail. For example, for a field called foo I have tried the following: public void setFoo(String key, Object val) { ... } or public void setFoo(String key, String[] val) { ... } I'm using a set of checkboxes on the JSP which should result in a list of the values of whichever boxes are selected. I can think of a number of javascript workarounds, as well as workarounds in my Action that go directly to the request parameters... but all of those are kludges and it seems like there should be a way to have multiple checkboxes that all reference a map-backed form property. Any thoughts? thanks a bunch, Mike Nidel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: map-backed forms with multibox/multiselect lists?
This works fine for list-backed form items (which we also use) but in this case I need something like public void setFoos(String key, String[] foos) is this possible? There are several workarounds I can think of, but this appears to be the cleanest solution if I can make it work. Mike -Original Message- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 9:42 AM To: Struts Users Mailing List Subject: Re: map-backed forms with multibox/multiselect lists? public void setFoos(String [] foos) On Fri, 4 Mar 2005 18:55:53 + (UTC), Mike Nidel [EMAIL PROTECTED] wrote: I'm trying to build a form element that combines the features of a map-backed property with a multibox (and the same for a multiple-selection list). I've made multiboxes work fine without the map-backed element, but I can't seem to get this to work. I've tried various method signatures in my form bean, but to no avail. For example, for a field called foo I have tried the following: public void setFoo(String key, Object val) { ... } or public void setFoo(String key, String[] val) { ... } I'm using a set of checkboxes on the JSP which should result in a list of the values of whichever boxes are selected. I can think of a number of javascript workarounds, as well as workarounds in my Action that go directly to the request parameters... but all of those are kludges and it seems like there should be a way to have multiple checkboxes that all reference a map-backed form property. Any thoughts? thanks a bunch, Mike Nidel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - 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: map-backed forms with multibox/multiselect lists?
I had the same problem some time ago (the solution vaguely suggested by Jack wouldn't had been an option since the properties were dynamic so I needed the key to distinguish between them). I asked on this list for help at that time, but didn't got an answer, so I guess nobody succeeded in doing something like this. Therefore I had to find some other solution to my problem... I'm guessing this might be some sort of a problem with commons-binutils (although public void setFoos(String key, String[] foos) isn't a valid javabeans setter so maybe it's just a bit out of it's scope). At 16:44 07.03.2005, you wrote: This works fine for list-backed form items (which we also use) but in this case I need something like public void setFoos(String key, String[] foos) is this possible? There are several workarounds I can think of, but this appears to be the cleanest solution if I can make it work. Mike -Original Message- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 9:42 AM To: Struts Users Mailing List Subject: Re: map-backed forms with multibox/multiselect lists? public void setFoos(String [] foos) On Fri, 4 Mar 2005 18:55:53 + (UTC), Mike Nidel [EMAIL PROTECTED] wrote: I'm trying to build a form element that combines the features of a map-backed property with a multibox (and the same for a multiple-selection list). I've made multiboxes work fine without the map-backed element, but I can't seem to get this to work. I've tried various method signatures in my form bean, but to no avail. For example, for a field called foo I have tried the following: public void setFoo(String key, Object val) { ... } or public void setFoo(String key, String[] val) { ... } I'm using a set of checkboxes on the JSP which should result in a list of the values of whichever boxes are selected. I can think of a number of javascript workarounds, as well as workarounds in my Action that go directly to the request parameters... but all of those are kludges and it seems like there should be a way to have multiple checkboxes that all reference a map-backed form property. Any thoughts? thanks a bunch, Mike Nidel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - 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]
multibox with label value beans
I do a dropdown list as follows with a list holding label value beans: html:select property=entries size='1' html:options collection=entries_list property=value labelProperty=label / /html:select How would I put these into a mulit-checkbox? Thanks for any assistance. -- The radiance of all the stars does not equal a sixteenth part of the moon's radiance, likewise, good deeds giving us merit, all these do not equal a sixteenth part of the merit of loving-kindness.. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
creating a for loop structure for multibox
Could someone please post an example of using a 'for loop' structure in a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page. thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: creating a for loop structure for multibox
-Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:21 PM To: [EMAIL PROTECTED] Subject: creating a for loop structure for multibox Could someone please post an example of using a 'for loop' structure in Using JSTL, or Struts tag libs? a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page. thanks - 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: creating a for loop structure for multibox
i am currently using struts tags and cant find a proper solution. it would be better to have a simple struts code, otherwise i'll try to use the JSTL. thank you Kedar Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:21 PM To: [EMAIL PROTECTED] Subject: creating a for loop structure for multibox Could someone please post an example of using a 'for loop' structure in Using JSTL, or Struts tag libs? a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page. thanks - 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: creating a for loop structure for multibox
-Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:52 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox i am currently using struts tags and cant find a proper solution. it would be better to have a simple struts code, otherwise i'll try to use the JSTL. Then you want the logic:iterate tag. thank you Kedar Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:21 PM To: [EMAIL PROTECTED] Subject: creating a for loop structure for multibox Could someone please post an example of using a 'for loop' structure in Using JSTL, or Struts tag libs? a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page. thanks - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: creating a for loop structure for multibox
bu then even if i pass the iterate tag a list of same lenth of required number of checkboxes, how would i make sure each checkbox has a unique 'value' value so that i know which ones are checked when the form is sent to the action? Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:52 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox i am currently using struts tags and cant find a proper solution. it would be better to have a simple struts code, otherwise i'll try to use the JSTL. Then you want the logic:iterate tag. thank you Kedar Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:21 PM To: [EMAIL PROTECTED] Subject: creating a for loop structure for multibox Could someone please post an example of using a 'for loop' structure in Using JSTL, or Struts tag libs? a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page. thanks - 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] - 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: creating a for loop structure for multibox
If I understand correctly, you will get from an Action an upper limit to the number of checkboxes to display, and you want each checkbox to be named 'valueX' where X is the value of the for loop. Some people will argue, but I don't see where a taglib is really required here... % // Assume you got a reference to your action form in af, // and that is has a getUpperLimit() method... int ul = af.getUpperLimit(); for (int i = 0; i ul; i++) { % input type=checkbox name=value%=i% % } % Not much more than that required. To make them retain state, you'll have to provide some method to determine when a given checkbox is checled, and add a checked attribte accordingly, something like: input type=checkbox name=value%=i% %=af.getIsChecked(i)=true?checked: That'll do the trick, assuming getIsChecked() accepts an index value and returns a boolean stating whether that particular checkbox is checked or not. I have a personal distaste for taglibs in most cases, I know many people disagree, but I figured you might as well know all your options, then you can choose whickever you prefer from an informed position. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:52 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox i am currently using struts tags and cant find a proper solution. it would be better to have a simple struts code, otherwise i'll try to use the JSTL. Then you want the logic:iterate tag. thank you Kedar Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:21 PM To: [EMAIL PROTECTED] Subject: creating a for loop structure for multibox Could someone please post an example of using a 'for loop' structure in Using JSTL, or Struts tag libs? a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page. thanks - 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] - 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: creating a for loop structure for multibox
-Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 2:14 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox If I understand correctly, you will get from an Action an upper limit to the number of checkboxes to display, and you want each checkbox to be named 'valueX' where X is the value of the for loop. Some people will argue, but I don't see where a taglib is really required here... % // Assume you got a reference to your action form in af, // and that is has a getUpperLimit() method... int ul = af.getUpperLimit(); for (int i = 0; i ul; i++) { % input type=checkbox name=value%=i% % } % Not much more than that required. To make them retain state, you'll have to provide some method to determine when a given checkbox is checled, and add a checked attribte accordingly, something like: input type=checkbox name=value%=i% %=af.getIsChecked(i)=true?checked: That'll do the trick, assuming getIsChecked() accepts an index value and returns a boolean stating whether that particular checkbox is checked or not. I have a personal distaste for taglibs in most cases, I know many people disagree, but I figured you might as well know all your options, then you can choose whickever you prefer from an informed position. And in that spirit: struts-html:multibox property=subscriptions struts-bean:write name=_bean property=code//struts-html:multibox struts-bean:write name=_bean property=description/br /struts-logic:iterate is 4 lines of code plus the 3 lines of code you'll need in reset. Plus the i18n ability with no additional codeing. Not to mention being able to hand off the code to the web design folks and have them easily make things purty. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:52 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox i am currently using struts tags and cant find a proper solution. it would be better to have a simple struts code, otherwise i'll try to use the JSTL. Then you want the logic:iterate tag. thank you Kedar Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:21 PM To: [EMAIL PROTECTED] Subject: creating a for loop structure for multibox Could someone please post an example of using a 'for loop' structure in Using JSTL, or Struts tag libs? a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page. thanks - 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] - 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: creating a for loop structure for multibox
From: Kedar Deshpande [EMAIL PROTECTED] bu then even if i pass the iterate tag a list of same lenth of required number of checkboxes, how would i make sure each checkbox has a unique 'value' value so that i know which ones are checked when the form is sent to the action? The List would contain the values. As you iterate over the List, for each multibox, the Struts framework will render it as checked if its value matches one of the values in the String[] that's in the Form bean. c:forEach items=${accountMap} var=item html-el:multibox property=accounts value=${item.key}/ c:out value=${item.key}/ br/ /c:forEach This uses a Map which is sitting in session scope. Yours might be a List, I think any Collection would do. In the example, 'accounts' is a String[] property of the Form bean. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: creating a for loop structure for multibox
Fair enough. But, now you are tied pretty securely to Struts. I'm not saying that's a bad thing or even a concern to most, but it is something to be aware of. We all strive for separation and low-coupling of everything these days, and rightly so, and to me that also means the ability to change frameworks without touching my presentation layer (within some necessary constraints of course) You make perfectly valid points though, so throw it all into the hopper and make a decision Kedar! :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Jim Barrows wrote: -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 2:14 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox If I understand correctly, you will get from an Action an upper limit to the number of checkboxes to display, and you want each checkbox to be named 'valueX' where X is the value of the for loop. Some people will argue, but I don't see where a taglib is really required here... % // Assume you got a reference to your action form in af, // and that is has a getUpperLimit() method... int ul = af.getUpperLimit(); for (int i = 0; i ul; i++) { % input type=checkbox name=value%=i% % } % Not much more than that required. To make them retain state, you'll have to provide some method to determine when a given checkbox is checled, and add a checked attribte accordingly, something like: input type=checkbox name=value%=i% %=af.getIsChecked(i)=true?checked: That'll do the trick, assuming getIsChecked() accepts an index value and returns a boolean stating whether that particular checkbox is checked or not. I have a personal distaste for taglibs in most cases, I know many people disagree, but I figured you might as well know all your options, then you can choose whickever you prefer from an informed position. And in that spirit: struts-html:multibox property=subscriptions struts-bean:write name=_bean property=code//struts-html:multibox struts-bean:write name=_bean property=description/br /struts-logic:iterate is 4 lines of code plus the 3 lines of code you'll need in reset. Plus the i18n ability with no additional codeing. Not to mention being able to hand off the code to the web design folks and have them easily make things purty. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:52 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox i am currently using struts tags and cant find a proper solution. it would be better to have a simple struts code, otherwise i'll try to use the JSTL. Then you want the logic:iterate tag. thank you Kedar Jim Barrows wrote: -Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 1:21 PM To: [EMAIL PROTECTED] Subject: creating a for loop structure for multibox Could someone please post an example of using a 'for loop' structure in Using JSTL, or Struts tag libs? a JSP. i need to get the loop limit from the action and then assign individual 'value' values for a column of checkboxes so that i know which ones were selected and so that they can be set again when viewing the page. thanks - 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] - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: creating a for loop structure for multibox
-Original Message- From: Kedar Deshpande [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 3:19 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox Both solutions seem like they will do the trick. thank you for giving me two choices to deceide from, i guess my choice will be based on wheather i want to stick firmly with struts tag or not. thanks for all your help Well, then you have JSTL... :) And, struts tags don't require struts. Jim and Frank. Frank W. Zammetti wrote: Fair enough. But, now you are tied pretty securely to Struts. I'm not saying that's a bad thing or even a concern to most, but it is something to be aware of. We all strive for separation and low-coupling of everything these days, and rightly so, and to me that also means the ability to change frameworks without touching my presentation layer (within some necessary constraints of course) You make perfectly valid points though, so throw it all into the hopper and make a decision Kedar! :) - 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: creating a for loop structure for multibox
It's also fair to tell you that you can do the same thing with JSTL and NOT be tied to Struts (assuming you abstract the ActionForm a little and don't do anything with it that can't be done with a normal bean later). Kind of a best of both worlds answer I guess, but I think JSTL tends to be just a hair more complicated (not much, but a little). -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Kedar Deshpande wrote: Both solutions seem like they will do the trick. thank you for giving me two choices to deceide from, i guess my choice will be based on wheather i want to stick firmly with struts tag or not. thanks for all your help Jim and Frank. Frank W. Zammetti wrote: Fair enough. But, now you are tied pretty securely to Struts. I'm not saying that's a bad thing or even a concern to most, but it is something to be aware of. We all strive for separation and low-coupling of everything these days, and rightly so, and to me that also means the ability to change frameworks without touching my presentation layer (within some necessary constraints of course) You make perfectly valid points though, so throw it all into the hopper and make a decision Kedar! :) - 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: creating a for loop structure for multibox
Well, then you have JSTL... :) And, struts tags don't require struts. As I just wrote in another reply :) Yeah, your right about the Struts tags, but I always worry that there might be something under the covers that ties it to Struts. Sure, I could look at the source, but I've never wanted to know that bad :) Eh, I knew I was saying something controversial to begin with :) I'm in the minority with regard to taglibs, I know that. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Jim and Frank. Frank W. Zammetti wrote: Fair enough. But, now you are tied pretty securely to Struts. I'm not saying that's a bad thing or even a concern to most, but it is something to be aware of. We all strive for separation and low-coupling of everything these days, and rightly so, and to me that also means the ability to change frameworks without touching my presentation layer (within some necessary constraints of course) You make perfectly valid points though, so throw it all into the hopper and make a decision Kedar! :) - 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: creating a for loop structure for multibox
Frank, I'll agree with you on not wanting taglibs to be tied directly into Struts. Why? Because I like the idea of modularity. I think this comes from skimming over struts-chains and thinking (GASP) there are things I could do without using the traditional struts at all. *shivers in fear AND excitement at that idea* Just my $0.02 worth. Regards, David -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 5:44 PM To: Struts Users Mailing List Subject: Re: creating a for loop structure for multibox Well, then you have JSTL... :) And, struts tags don't require struts. As I just wrote in another reply :) Yeah, your right about the Struts tags, but I always worry that there might be something under the covers that ties it to Struts. Sure, I could look at the source, but I've never wanted to know that bad :) Eh, I knew I was saying something controversial to begin with :) I'm in the minority with regard to taglibs, I know that. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Jim and Frank. Frank W. Zammetti wrote: Fair enough. But, now you are tied pretty securely to Struts. I'm not saying that's a bad thing or even a concern to most, but it is something to be aware of. We all strive for separation and low-coupling of everything these days, and rightly so, and to me that also means the ability to change frameworks without touching my presentation layer (within some necessary constraints of course) You make perfectly valid points though, so throw it all into the hopper and make a decision Kedar! :) - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multibox DynaActionForm
How I can prepopulate a form containing a multibox when using DynaActionForms? The following code doesn't seem to work - it wont check any checkboxes (why?) --- Action which prepopulates the form: --- String[] companies = MyDBTools.getUser(userId).getCompanies(); ArrayList allCompanies = MyDBTools.getAllCompanies(); _request.setAttribute(selectedCompanies, companies); _request.setAttribute(allCompanies, allCompanies ); --- Form --- logic:iterate id=company name=allCompanies html:multibox property=selectedCompanies bean:write name=company property=id/ /html:multibox bean:write name=company property=name/ br /logic:iterate --- Form-bean --- form-bean name=forms.myForm type=org.apache.struts.validator.DynaValidatorForm form-property name=selectedCompanies type=java.lang.String[] / /form-bean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multibox DynaActionForm
You will need to set the selectedCompanies in the ActionForm so that the html:multibox .../ can determine which companies have been selected by comparing the company id against the selected company id. If allCompanies does not change per user, you may want to place that in the ServletContext on application startup to avoid the database hit everytime that action is executed. robert -Original Message- From: Jaakko Rytinki [mailto:[EMAIL PROTECTED] Sent: Thursday, December 09, 2004 9:14 AM To: Struts Users Mailing List Subject: Multibox DynaActionForm How I can prepopulate a form containing a multibox when using DynaActionForms? The following code doesn't seem to work - it wont check any checkboxes (why?) --- Action which prepopulates the form: --- String[] companies = MyDBTools.getUser(userId).getCompanies(); ArrayList allCompanies = MyDBTools.getAllCompanies(); _request.setAttribute(selectedCompanies, companies); _request.setAttribute(allCompanies, allCompanies ); --- Form --- logic:iterate id=company name=allCompanies html:multibox property=selectedCompanies bean:write name=company property=id/ /html:multibox bean:write name=company property=name/ br /logic:iterate --- Form-bean --- form-bean name=forms.myForm type=org.apache.struts.validator.DynaValidatorForm form-property name=selectedCompanies type=java.lang.String[] / /form-bean - 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: Multibox DynaActionForm
Ah.. stupid me =) So the solution with dynaactionform is: --- public ActionForward execute(ActionMapping _mapping, ActionForm _form, HttpServletRequest _request, HttpServletResponse _response) throws Exception { DynaActionForm dynaForm = (DynaActionForm) _form; String userId = (String) dynaForm.get(userId); String[] companies = MyDBTools.getUser(userId).getCompanies(); ArrayList allCompanies = MyDBTools.getAllCompanies(); dynaForm.set(selectedCompanies, companies); _request.setAttribute(allCompanies, allCompanies ); return _mapping.findForward(continue); } -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 9. joulukuuta 2004 17:13 To: Struts Users Mailing List Subject: RE: Multibox DynaActionForm You will need to set the selectedCompanies in the ActionForm so that the html:multibox .../ can determine which companies have been selected by comparing the company id against the selected company id. If allCompanies does not change per user, you may want to place that in the ServletContext on application startup to avoid the database hit everytime that action is executed. robert -Original Message- From: Jaakko Rytinki [mailto:[EMAIL PROTECTED] Sent: Thursday, December 09, 2004 9:14 AM To: Struts Users Mailing List Subject: Multibox DynaActionForm How I can prepopulate a form containing a multibox when using DynaActionForms? The following code doesn't seem to work - it wont check any checkboxes (why?) --- Action which prepopulates the form: --- String[] companies = MyDBTools.getUser(userId).getCompanies(); ArrayList allCompanies = MyDBTools.getAllCompanies(); _request.setAttribute(selectedCompanies, companies); _request.setAttribute(allCompanies, allCompanies ); --- Form --- logic:iterate id=company name=allCompanies html:multibox property=selectedCompanies bean:write name=company property=id/ /html:multibox bean:write name=company property=name/ br /logic:iterate --- Form-bean --- form-bean name=forms.myForm type=org.apache.struts.validator.DynaValidatorForm form-property name=selectedCompanies type=java.lang.String[] / /form-bean - 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: Multibox deselection problem
use disabled instead of readonly. IIRC , HTML rarely uses readonly -- its mostly disabled attribute everywhere. It works just fine for me. html:multibox property=selectedCheckboxes disabled=truebean:write name=item//html:multibox -Original Message- From: Olivier Croisier [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 4:10 AM To: Struts Users Mailing List Subject: Re: Multibox deselection problem Hi ! Thank you for you help, it works fine now ! BTW, it seems like Struts does not support all standart HTML options : I had to use a pure HTML INPUT tag because the readonly attribute does not exist in Struts, and I think this mix is a bit dirty. But it works... (onLoad not supported either...) Olivier Croisier This is a problem with HTTP: when all the checkboxes are deselected, the browser doesn't send anything back, so you get the default of what you started with. To solve this problem you must ensure that at least one box is always selected. I solved this problem by creating an additional checkbox that is hidden, read-only and selected. This will ensure that the browser sends something back. String[] defaultEntities = {A, B, C, D, filler}; tr style=display:none;tdhtml:multibox property=marketing value=filler//td/tr Wiebe -Original Message- From: Olivier Croisier [mailto:[EMAIL PROTECTED] Sent: Friday, November 12, 2004 6:47 AM To: [EMAIL PROTECTED] Subject: Multibox deselection problem Hi ! I have a problem with the Multibox behaviour. I have checked the online doc but nothing helped me so far... Here is my problem : My app workflow is : prepareImportAction.do - Import.jsp - processImportAction.do In the prepareImportAction.do, I initialize the entities var (of type String[], in session scope), so that the checkboxes are checked by default when the jsp page is displayed : String[] defaultEntities = {A, B, C, D}; myform.set(entities, defaultEntities); In the jsp page, I have a set of : html:multibox property=entities value=A/ html:multibox property=entities value=B/ html:multibox property=entities value=C/ html:multibox property=entities value=D/ I also have a small javascript that allows the user to select or deselect all checkboxes in one click : function checkAll(field) { var i; for (i=0;ifield.length;i++) { field[i].checked=true; } } (nearly the same for de-selecting all checkboxes) Now here is my problem. When I de-select all the checkboxes in my jsp page, by hand or by javascript, my processImport.do receives a String[] array containing the entities that were defined in preparaImport.do as default, instead of an empty array. This only happens only when all entities are deselected : if a single one is selected, I get the desired behaviour. May you help me to understand where I am wrong and why it doesn't work please? Olivier Croisier -- CROISIER Olivier Software Engineer Thales IS - ANS [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. Thank you, Standard Poor's - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multibox deselection problem
Hi ! Thank you for you help, it works fine now ! BTW, it seems like Struts does not support all standart HTML options : I had to use a pure HTML INPUT tag because the readonly attribute does not exist in Struts, and I think this mix is a bit dirty. But it works... (onLoad not supported either...) Olivier Croisier This is a problem with HTTP: when all the checkboxes are deselected, the browser doesn't send anything back, so you get the default of what you started with. To solve this problem you must ensure that at least one box is always selected. I solved this problem by creating an additional checkbox that is hidden, read-only and selected. This will ensure that the browser sends something back. String[] defaultEntities = {A, B, C, D, filler}; tr style=display:none;tdhtml:multibox property=marketing value=filler//td/tr Wiebe -Original Message- From: Olivier Croisier [mailto:[EMAIL PROTECTED] Sent: Friday, November 12, 2004 6:47 AM To: [EMAIL PROTECTED] Subject: Multibox deselection problem Hi ! I have a problem with the Multibox behaviour. I have checked the online doc but nothing helped me so far... Here is my problem : My app workflow is : prepareImportAction.do - Import.jsp - processImportAction.do In the prepareImportAction.do, I initialize the entities var (of type String[], in session scope), so that the checkboxes are checked by default when the jsp page is displayed : String[] defaultEntities = {A, B, C, D}; myform.set(entities, defaultEntities); In the jsp page, I have a set of : html:multibox property=entities value=A/ html:multibox property=entities value=B/ html:multibox property=entities value=C/ html:multibox property=entities value=D/ I also have a small javascript that allows the user to select or deselect all checkboxes in one click : function checkAll(field) { var i; for (i=0;ifield.length;i++) { field[i].checked=true; } } (nearly the same for de-selecting all checkboxes) Now here is my problem. When I de-select all the checkboxes in my jsp page, by hand or by javascript, my processImport.do receives a String[] array containing the entities that were defined in preparaImport.do as default, instead of an empty array. This only happens only when all entities are deselected : if a single one is selected, I get the desired behaviour. May you help me to understand where I am wrong and why it doesn't work please? Olivier Croisier -- CROISIER Olivier Software Engineer Thales IS - ANS [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multibox deselection problem
Olivier Croisier wrote the following on 11/12/2004 9:46 AM: Now here is my problem. When I de-select all the checkboxes in my jsp page, by hand or by javascript, my processImport.do receives a String[] array containing the entities that were defined in preparaImport.do as default, instead of an empty array. Use the form reset method to always set the String array to an empty array first. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multibox deselection problem
Hi ! I have a problem with the Multibox behaviour. I have checked the online doc but nothing helped me so far... Here is my problem : My app workflow is : prepareImportAction.do - Import.jsp - processImportAction.do In the prepareImportAction.do, I initialize the entities var (of type String[], in session scope), so that the checkboxes are checked by default when the jsp page is displayed : String[] defaultEntities = {A, B, C, D}; myform.set(entities, defaultEntities); In the jsp page, I have a set of : html:multibox property=entities value=A/ html:multibox property=entities value=B/ html:multibox property=entities value=C/ html:multibox property=entities value=D/ I also have a small javascript that allows the user to select or deselect all checkboxes in one click : function checkAll(field) { var i; for (i=0;ifield.length;i++) { field[i].checked=true; } } (nearly the same for de-selecting all checkboxes) Now here is my problem. When I de-select all the checkboxes in my jsp page, by hand or by javascript, my processImport.do receives a String[] array containing the entities that were defined in preparaImport.do as default, instead of an empty array. This only happens only when all entities are deselected : if a single one is selected, I get the desired behaviour. May you help me to understand where I am wrong and why it doesn't work please? Olivier Croisier -- CROISIER Olivier Software Engineer Thales IS - ANS [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multibox deselection problem
This is a problem with HTTP: when all the checkboxes are deselected, the browser doesn't send anything back, so you get the default of what you started with. To solve this problem you must ensure that at least one box is always selected. I solved this problem by creating an additional checkbox that is hidden, read-only and selected. This will ensure that the browser sends something back. String[] defaultEntities = {A, B, C, D, filler}; tr style=display:none;tdhtml:multibox property=marketing value=filler//td/tr Wiebe -Original Message- From: Olivier Croisier [mailto:[EMAIL PROTECTED] Sent: Friday, November 12, 2004 6:47 AM To: [EMAIL PROTECTED] Subject: Multibox deselection problem Hi ! I have a problem with the Multibox behaviour. I have checked the online doc but nothing helped me so far... Here is my problem : My app workflow is : prepareImportAction.do - Import.jsp - processImportAction.do In the prepareImportAction.do, I initialize the entities var (of type String[], in session scope), so that the checkboxes are checked by default when the jsp page is displayed : String[] defaultEntities = {A, B, C, D}; myform.set(entities, defaultEntities); In the jsp page, I have a set of : html:multibox property=entities value=A/ html:multibox property=entities value=B/ html:multibox property=entities value=C/ html:multibox property=entities value=D/ I also have a small javascript that allows the user to select or deselect all checkboxes in one click : function checkAll(field) { var i; for (i=0;ifield.length;i++) { field[i].checked=true; } } (nearly the same for de-selecting all checkboxes) Now here is my problem. When I de-select all the checkboxes in my jsp page, by hand or by javascript, my processImport.do receives a String[] array containing the entities that were defined in preparaImport.do as default, instead of an empty array. This only happens only when all entities are deselected : if a single one is selected, I get the desired behaviour. May you help me to understand where I am wrong and why it doesn't work please? Olivier Croisier -- CROISIER Olivier Software Engineer Thales IS - ANS [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]
SV: Multibox problem
Hi Robert! Thanks for your answer. It pointed me to the problem. I used the add instead of addAll of the Collection-interface. So instead of adding the elements (Strings) I added the collection as a collection. Regards Roland Carlsson Den 04-11-03 11.50, skrev Robert Taylor [EMAIL PROTECTED]: How many items are in the func data structure in request scope? This is what drives the number of iterations. robert -Original Message- From: Roland Carlsson [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 03, 2004 5:02 AM To: Struts Users Mailing List Subject: Multibox problem Hi! I'm trying to create a set of checkboxes with the MulitBox-tag. The problem is that I get an extra checkbox with brackets around its value, like in this html-code where I expect two checkboxes but get three: input type=checkbox name=functions value=[test, prov] [test, prov] input type=checkbox name=functions value=prov checked=checked prov input type=checkbox name=functions value=test checked=checked test My page has this code inside it: (funk are a Collection stored in the request, filedata has the property functions that also is a Collection) logic:iterate id=item name=func scope=request html:multibox name=filedata property=functions bean:write name=item/ /html:multibox bean:write name=item/ /logic:iterate Could you please point out why I get this extra checkbox Thanks in advance Roland Carlsson ps: I have looked in the arcives but it says it doesn't support textsearch - 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]
multibox validation using validwhen
I am trying to use validwhen with html multibox in struts tag. In my JSP I am using a) a html:multibox which renders 4 check boxes for me (using iterate tag). In my actionform this multibox property stores values to a String Array property name reasons and b) a text field of property name dispatch - this textfield dispatch will have only 2 string values Either process or reject (assume it gets dynamically assigned these String values) all i want to do is that to ensure no checkboxes are checked when the text field dispatch==process and All (or) atleast one check box is checked when dispatch==reject I am aware of some integer comparison bug with 1.2.4 while using validwhen. now am using 1.2.5 but none of my combinations seem to work. One of the combinations I tried is below mentioned. This nearly works but does not ensure the checkboxes are checked when dispatch==reject field property=reasons indexedListProperty=reasons depends=validwhen page=1 arg key=error.reasons.input position=0 / var var-nametest/var-name var-value(((dispatch == process) and (*this* == null)) or ((dispatch == reject) and (*this* != null)))/var-value /var /field NOTE: for some reason when I submit these 4 checkboxes UNCHECKED, they seem to be *NOT* NULL. They get initialized to a zero length array. I am not initializing the reasons property in the struts-config.xml. So this property must be initialized to null, which happens all fine. But when empty unchecked check boxes are submitted the reasons property is no more null but a zero length array. I would really appreciate if someone can just reply me with a solution. Many thanks in advance. ___ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
conditional multibox validation using validwhen
I am trying to use validwhen with html multibox in struts tag. In my JSP I am using a) A html:multibox which renders 4 check boxes for me (using iterate tag). In my ActionForm this multibox property stores values to a String Array property name reasons And b) A text field of property name dispatch - This textfield dispatch will have only 2 string values Either process or reject (assume it gets dynamically assigned these String values) All I want to do is that to ensure no checkboxes are checked when the text field dispatch==process AND All (or) at least one check box is checked when dispatch==reject I am aware of some integer comparison bug with 1.2.4 while using validwhen. Now I am using 1.2.5 but none of my combinations seem to work. One of the combinations I tried is below mentioned. This nearly works but does not ensure the checkboxes are checked when dispatch==reject field property=reasons indexedListProperty=reasons depends=validwhen page=1 arg key=error.reasons.input position=0 / var var-nametest/var-name var-value(((dispatch == process) and (*this* == null)) or ((dispatch == reject) and (*this* != null)))/var-value /var /field NOTE: for some reason when I submit these 4 checkboxes UNCHECKED, they seem to be *NOT* NULL. They get initialized to a zero length array. I am not initializing the reasons property in the struts-config.xml. So this property must be initialized to null, which happens all fine. But when empty unchecked check boxes are submitted the reasons property is no more null but a zero length array. I would really appreciate if someone can just reply me with a solution. Many thanks in advance. ___ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DynaValidatorForm and multibox
I'm using struts 1.1 Is it possible to use a multibox with a DynaValidatorForm? Are there any documented examples? I searched the archives...no mention of it. Thanks, Brian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaValidatorForm and multibox
From: Brian Kuhn [EMAIL PROTECTED] I'm using struts 1.1 Is it possible to use a multibox with a DynaValidatorForm? Sure. I use a String[] property in the dynamic form, and it works fine. If you're having trouble with it, post the relevant parts of the config files and JSP and someone will take a look. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Help! Questions about Checkbox and multibox
Hi t, I'm having my own problems with checkboxes / multiboxes. However, I think I can help u a bit with some of those questions. - When you check a box and submit it, the value that gets submitted is the one on the value attribute of that checkbox. - When you check more than one checkbox with the same name, you'll need an array-type property for Struts handling it properly. Each position on the array generated (setXXX-ed) by Struts will be the value of a checked box. - I haven't actually implemented this lately, but I believe that, in case your screen is the kind that refresh itself after the post (i.e. no post / redirect technique being used), then you might have to reset the array on the reset() method of the corresponding actionForm. In any case, you might want to check Struts' web site for more info on this issue. HTH, Freddy- -Mensaje original- De: t t [mailto:[EMAIL PROTECTED] Enviado el: miercoles, 13 de octubre de 2004 3:31 Para: [EMAIL PROTECTED] Asunto: Help! Questions about Checkbox and multibox Hi, all, I have some questions regarding Checkbox and multibox: 1. What value will be returned if a checkbox is checked? How to get it from the relevant form bean? any example? 2. If I want to check a group of checkboxes (multibox) after a single checkbox is checked, how to do that? I guess javascript will be a good way, but in java script, how to get the reference of checkbox and multibox defined by struts ? any example? Thanks in advance! Tong __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - 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]
Help! Questions about Checkbox and multibox
Hi, all, I have some questions regarding Checkbox and multibox: 1. What value will be returned if a checkbox is checked? How to get it from the relevant form bean? any example? 2. If I want to check a group of checkboxes (multibox) after a single checkbox is checked, how to do that? I guess javascript will be a good way, but in java script, how to get the reference of checkbox and multibox defined by struts ? any example? Thanks in advance! Tong __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multibox indexed
Hello, I have a big Problem with reading the values of the text-field in the iterate-tag. The Value with the ID=1 is all time wrong! and the athers are ok.? The Value with the index=1 is all time the value of the initialisation and not the changed. My JSP: html:form action=/ProjektDDE.do . logic:iterate id=ente name=projektForm property=enten indexId=ID tr td class=tl1html:multibox property=selDDE value= %=ID.toString()%/html:multiboxnbsp;bean:write name=ente property=dde//td td class=tl1bean:write name=ente property=name//td td class=tl1bean:write name=ente property =beschreibung//td td class=tl1html:text property=%=labelValue[ +ID+].label% size=2//td /tr /logic:iterate My ActionForm: public LabelValueBean getLabelValue(int index){ return beans[index]; } public void setLabels(LabelValueBean[] beans){ this.beans=beans; } public void setSelDDE(String[] selDDE){ this.selDDE=selDDE; } public String[] getSelDDE(){ return selDDE; } In the ActionClass befor show the JSP I write the LabelValueBeans: LabelValueBean[] beans=new LabelValueBean[enten.size()]; for(int i=0;ienten.size() ;i++){ LabelValueBean bean=new LabelValueBean(3,new Integer(i).toString()); beans[i]=bean; } form.setLabels(beans); After call ProjektDDE.do I read the selDDE and the LabelValueBean. The values in selDDE from the checkbox are ok, but the value from the LabelValueBean-Array are for the index=1 not correct! (Only for the index=1, the others are ok. The Label for the index = i is all time the initialvalue (in this case 3)). Whats wrong? Thanks Claudia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with multibox
Hi, I have a Problem with using multiboxes. I want to generate following HTML-Code: input type=checkbox name=sel value=2002Ronja input type=checkbox name=sel value=2003Petra input type=checkbox name=sel value=2004Heini But I became: input type=checkbox name=sel value=20022002 Ronja input type=checkbox name=sel value=20032003 Petra input type=checkbox name=sel value=20042004 Heini What must I do??? Thanks Claudia My JSP-Code: logic:iterate id=item name=form property=items trtd html:multibox property=sel bean:write name=item property=jahr/ bean:write name=item property=name/ /html:multibox bean:write name=item property=jahr/ bean:write name=item property=name/ /td/tr /logic:iterate And my ActionForm: public class MyForm extends ActionForm{ /** Creates a new instance of MyForm */ public MyForm() { MyBean eins=new MyBean(); eins.setJahr(2002); eins.setName(Ronja); MyBean zwei=new MyBean(); zwei.setJahr(2003); zwei.setName(Petra); MyBean drei=new MyBean(); drei.setJahr(2004); drei.setName(Heini); init=new Object[3]; init[0]=eins; init[1]=zwei; init[2]=drei; } private Object[] items, init,sel; public Object[] getItems(){ return items; } public void setItems(Object[] v){ items=v; } public Object[] getSel(){ return sel; } public void setSel(Object[] selected){ sel=selected; } public void reset(ActionMapping mapping,HttpServletRequest req){ System.out.println(bin in reset); items=new Object[3]; items=init; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with multibox
Try, logic:iterate id=item name=form property=items trtd html:multibox property=sel bean:write name=item property=jahr/ /html:multibox bean:write name=item property=name/ /td/tr /logic:iterate - Original Message - From: Claudia Woestheinrich [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 1:21 PM Subject: problem with multibox Hi, I have a Problem with using multiboxes. I want to generate following HTML-Code: input type=checkbox name=sel value=2002Ronja input type=checkbox name=sel value=2003Petra input type=checkbox name=sel value=2004Heini But I became: input type=checkbox name=sel value=20022002 Ronja input type=checkbox name=sel value=20032003 Petra input type=checkbox name=sel value=20042004 Heini What must I do??? Thanks Claudia My JSP-Code: logic:iterate id=item name=form property=items trtd html:multibox property=sel bean:write name=item property=jahr/ bean:write name=item property=name/ /html:multibox bean:write name=item property=jahr/ bean:write name=item property=name/ /td/tr /logic:iterate And my ActionForm: public class MyForm extends ActionForm{ /** Creates a new instance of MyForm */ public MyForm() { MyBean eins=new MyBean(); eins.setJahr(2002); eins.setName(Ronja); MyBean zwei=new MyBean(); zwei.setJahr(2003); zwei.setName(Petra); MyBean drei=new MyBean(); drei.setJahr(2004); drei.setName(Heini); init=new Object[3]; init[0]=eins; init[1]=zwei; init[2]=drei; } private Object[] items, init,sel; public Object[] getItems(){ return items; } public void setItems(Object[] v){ items=v; } public Object[] getSel(){ return sel; } public void setSel(Object[] selected){ sel=selected; } public void reset(ActionMapping mapping,HttpServletRequest req){ System.out.println(bin in reset); items=new Object[3]; items=init; } } - 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]
Antwort: Re: problem with multibox
..Thanks that works. Now I have in the JSP-Page checkboxes and textfields. I want to write the two values (test,info) in an Map or Array[][]. How must I do this in the ActionForm? Thanks Claudia My JSP: logic:iterate id=item name=form property=test html:multibox property=sel bean:write name=item property=id/ /html:multibox bean:write name=item property=name/ html:text property=info/ /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Antwort: Re: problem with multibox
Form: --- public ArrayList getTest() { return mTest; } public void setTest(ArrayList test) { mTest = test; } public Item getItem(int i) { return (Item)mTest.get(i); } private ArrayList mTest; JSP: - c:forEach items=${form.test} var=item varStatus=status html-el:multibox property=sel value=${item.id}/ c:out value=${item.name}/ html-el:text property=item[${status.index}].info/ /c:forEach - Original Message - From: Claudia Woestheinrich [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 4:29 PM Subject: Antwort: Re: problem with multibox ..Thanks that works. Now I have in the JSP-Page checkboxes and textfields. I want to write the two values (test,info) in an Map or Array[][]. How must I do this in the ActionForm? Thanks Claudia My JSP: logic:iterate id=item name=form property=test html:multibox property=sel bean:write name=item property=id/ /html:multibox bean:write name=item property=name/ html:text property=info/ /logic:iterate - 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: Multibox/LabelValueBean Input Forms -- Paged Input
The logic iterate tag has offset and length attributes which you can use to control display subsets to a collection/array. So if you wanted to show the second page of 10 logic:iterate id=myLabelBeans name=myForm property=myLabelBeans offset=10 length=10 html:checkbox name=myLabelBeans property=myValue indexed=true bean:write name=myLabelBeans property=myLabel/ /html:checkbox /logic:iterate If you are using jstl then then c:forEach tag has begin and end attributes c:forEach var=myLabelBeans items=$(myForm.myLabelBeans} begin=10 end=19 html:checkbox name=myLabelBeans property=myValue indexed=true bean:write name=myLabelBeans property=myLabel/ /html:checkbox /c:forEach Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 11, 2004 1:47 AM Subject: Multibox/LabelValueBean Input Forms -- Paged Input I have found an example on the net where a LabelValueBean array and a string array are encapsulated inside a custom ActionForm object giving the user the ability to select checkboxed values and store the values behind the scene with labeling each checkbox with the LabelValueBean's label property. This works great for small amounts of checkbox input, such as less than 10; however the goal I have been tasked with is to expand on this where the data set is say 100 elements and each form page displays a subset of 10 items of the entire 100 element data set. Once the user has traversed through all 100 items or selected those they wish, the form should contain an array of items that range the entire 100 element dataset which the user has selected. Any thoughts, suggestions, or examples of something like this others have done in the past? Chris - 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]
Multibox combined with other fields
Hi: I have a form that may contain one or more rows. Each row has a passenger data. All the passengers in the form consists in a reservation: Number Title NameExtraSeat CabinBaggage 1 Mr Carlos Gardel Yes(1) No(1) 2 Mr J.Manuel Fangio No(2) No(2) 3 Mr Guillermo Vilas No(3) No(3) 4 Mr Diego Maradona Yes(4) Yes(4) ExtraSeat and CabinBaggage uses multiboxes and should be boolean values. When I submit this form, the multiboxes that are checked are sent, but the unchecked arent. When posted, I receive arrays of string with: Number={1, 2, 3, 4} Title={Mr, Mr, Mr, Mr} Name={Carlos Gardel, J.Manuel Fangio, Guillermo Vilas, Diego Maradona} ExtraSeat={1, 4} CabinBaggage={4} What is the usual solution for this using plain struts? Do i should calculate the missing extraseat and cabinbaggage in the reset form? Is there any helper class for completing the missing non posted checkboxes to indicate true or false in that porperties? In fact, i should need to have this arrays in order proceed in persisting this reservation: Number={1, 2, 3, 4} Title={Mr, Mr, Mr, Mr} Name={Carlos Gardel, J.Manuel Fangio, Guillermo Vilas, Diego Maradona} ExtraSeat={true, false, false, true} CabinBaggage={false, false, false, true} Thanks in advance. Guillermo Meyer System Engineer EDS Argentina - Proyecto X71 Interbanking. 54.11.4322-1307 NOTA DE CONFIDENCIALIDAD Este mensaje (y sus anexos) es confidencial, esta dirigido exclusivamente a las personas direccionadas en el mail y puede contener informacion (i)de propiedad exclusiva de Interbanking S.A. o (ii) amparada por el secreto profesional. Cualquier opinion en el contenido, es exclusiva de su autor y no representa necesariamente la opinion de Interbanking S.A. El acceso no autorizado, uso, reproduccion, o divulgacion esta prohibido. Interbanking S.A no asumira responsabilidad ni obligacion legal alguna por cualquier informacion incorrecta o alterada contenida en este mensaje. Si usted ha recibido este mensaje por error, le rogamos tenga la amabilidad de destruirlo inmediatamente junto con todas las copias del mismo, notificando al remitente. No debera utilizar, revelar, distribuir, imprimir o copiar este mensaje ni ninguna de sus partes si usted no es el destinatario. Muchas gracias. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multibox mayhem
I have one multibox per page on a few pages. Each page name is represented by the 'key' property of a HashMap. Each selected checkbox number is stored in Integer[]'s in the 'value' property of a HashMap. After selecting all of the checks, the user is forwarded to a confirmation.jsp which displays the selections. the code: (i removed table formatting for clarity) logic:iterate id=bean1 name=multiBoxForm property=allofem bean:write name=bean1 property=key/ logic:iterate id=bean2 name=bean1 property=value bean:write name=bean2 / /logic:iterate /logic:iterate this works fine to display the selections when they are read from the original ActionForm. i can update the db and then read them back which works fine too. i have confirmed that i have a HashMap with the correct Integer[]'s from the db inside, however the same code as the previous is located in profile.jsp and it returns the following JasperException: Cannot find bean bean2 in any scope Any ideas? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multibox mayhem
i had to add logic:empty tags around the bean:write name=bean2/ because there were some trailing 'null' values in the Integer[] after reading from DB. pls [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have one multibox per page on a few pages. Each page name is represented by the 'key' property of a HashMap. Each selected checkbox number is stored in Integer[]'s in the 'value' property of a HashMap. After selecting all of the checks, the user is forwarded to a confirmation.jsp which displays the selections. the code: (i removed table formatting for clarity) logic:iterate id=bean1 name=multiBoxForm property=allofem bean:write name=bean1 property=key/ logic:iterate id=bean2 name=bean1 property=value bean:write name=bean2 / /logic:iterate /logic:iterate this works fine to display the selections when they are read from the original ActionForm. i can update the db and then read them back which works fine too. i have confirmed that i have a HashMap with the correct Integer[]'s from the db inside, however the same code as the previous is located in profile.jsp and it returns the following JasperException: Cannot find bean bean2 in any scope Any ideas? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: multibox mayhem
from this code : bean:write name=bean1 property=key/ I guess that bean1 must be an object inside 'allofem' So why are you trying to iterate an object : logic:iterate id=bean2 name=bean1 property=value pls wrote: i had to add logic:empty tags around the bean:write name=bean2/ because there were some trailing 'null' values in the Integer[] after reading from DB. pls [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have one multibox per page on a few pages. Each page name is represented by the 'key' property of a HashMap. Each selected checkbox number is stored in Integer[]'s in the 'value' property of a HashMap. After selecting all of the checks, the user is forwarded to a confirmation.jsp which displays the selections. the code: (i removed table formatting for clarity) logic:iterate id=bean1 name=multiBoxForm property=allofem bean:write name=bean1 property=key/ logic:iterate id=bean2 name=bean1 property=value bean:write name=bean2 / /logic:iterate /logic:iterate this works fine to display the selections when they are read from the original ActionForm. i can update the db and then read them back which works fine too. i have confirmed that i have a HashMap with the correct Integer[]'s from the db inside, however the same code as the previous is located in profile.jsp and it returns the following JasperException: Cannot find bean bean2 in any scope Any ideas? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I use multibox with text fields?
Hello Miguel, You might want to search the archive for indexed properties; I think that's what you're looking for. HTH, ATTA - Original Message - From: Miguel Arroz [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 02, 2004 4:04 PM Subject: Can I use multibox with text fields? Hi! I need to display a page that loads a list of items from a DB, and that displays that list, with a text field and a checkbox per row. The checkbox is easy to do, using multibox. But how can I get the text field? Can I use something like multibox (and then read all the text boxes from an array), or do I have to do this manually (using iterate, etc)? Yours Miguel Arroz Fire, walk with me. Miguel Arroz - [EMAIL PROTECTED] - http://www.guiamac.com - 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]
JSTL and Multibox Submit Problem
Hi there, I am having a problem getting the checked values from a multibox that is submitted to my action and I was hoping one of you could help me out. I followed Ted Husted's example of using a Multibox within an iteration but I have a feeling that my setup is a bit different and thus renders a different solution. I'm using a JSTL forEach loop to loop through a list of MessageInstance objects. I want the user to be able to check which MessageInstances should be deleted and the action to perform the deletion. Everything gets rendered ok but when the form is submitted, the String[] object in the form is empty. I should also note that everything works fine if I use an html:submit but when I try to use an html:link to do the submit I don't get any checked values in my String[] object. I've included some code snippets below. Any help would be awesome. Thanks! Ricardo JSP: === Submit Link (inside ManageNotesForm): jsp:useBean id=deleteNotesLink class= java.util.HashMap/ c:set target=${deleteNotesLink} property=membername value=${requestScope.membername}/ c:set target=${deleteNotesLink} property=task value=delete/ html:link action=/submitMain name=deleteNotesLinkdelete/html:link forEach Loop (inside ManageNotesForm): = c:forEach items=${sessionScope.messageInstances} var=aMessageInstance varStatus=status html:multibox name=${formName} property=selectedItems c:out value=${aMessageInstance.id}/ /html:multibox c:out value=${aMessageInstance.id}/ /c:forEach ManageNotesForm Bean: private String[] selectedItems = {}; public String[] getSelectedItems() { return selectedItems; } public void setSelectedItems(String[] selectedItems) { this.selectedItems = selectedItems; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSTL and Multibox Submit Problem
Ricardo, If you are going to use the html:link tag, then you need to have it trigger a call to a JavaScript function that will submit the form for you. Otherwise, jjust clicking the link will not submit the form. Regards, Richard --- Ricardo Cortes [EMAIL PROTECTED] wrote: Hi there, I am having a problem getting the checked values from a multibox that is submitted to my action and I was hoping one of you could help me out. I followed Ted Husted's example of using a Multibox within an iteration but I have a feeling that my setup is a bit different and thus renders a different solution. I'm using a JSTL forEach loop to loop through a list of MessageInstance objects. I want the user to be able to check which MessageInstances should be deleted and the action to perform the deletion. Everything gets rendered ok but when the form is submitted, the String[] object in the form is empty. I should also note that everything works fine if I use an html:submit but when I try to use an html:link to do the submit I don't get any checked values in my String[] object. I've included some code snippets below. Any help would be awesome. Thanks! Ricardo JSP: === Submit Link (inside ManageNotesForm): jsp:useBean id=deleteNotesLink class= java.util.HashMap/ c:set target=${deleteNotesLink} property=membername value=${requestScope.membername}/ c:set target=${deleteNotesLink} property=task value=delete/ html:link action=/submitMain name=deleteNotesLinkdelete/html:link forEach Loop (inside ManageNotesForm): = c:forEach items=${sessionScope.messageInstances} var=aMessageInstance varStatus=status html:multibox name=${formName} property=selectedItems c:out value=${aMessageInstance.id}/ /html:multibox c:out value=${aMessageInstance.id}/ /c:forEach ManageNotesForm Bean: private String[] selectedItems = {}; public String[] getSelectedItems() { return selectedItems; } public void setSelectedItems(String[] selectedItems) { this.selectedItems = selectedItems; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL and Multibox Submit Problem (SOLVED)
That makes sense. I'm not sure why I didn't think of that. I guess I was assuming the html:link would take care of the form submission since it was embedded in an html:form. So, I've added an onclick attribute to my html:link as follows and it worked just fine: html:link onclick=document.forms[0].submit(); href=# name=deleteNotesLinkdelete/html:link Voila! (It's the French Open this week.) Thanks Richard. -Original Message- From: Richard Yee [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 25, 2004 11:36 AM To: Struts Users Mailing List Subject: Re: JSTL and Multibox Submit Problem Ricardo, If you are going to use the html:link tag, then you need to have it trigger a call to a JavaScript function that will submit the form for you. Otherwise, jjust clicking the link will not submit the form. Regards, Richard --- Ricardo Cortes [EMAIL PROTECTED] wrote: Hi there, I am having a problem getting the checked values from a multibox that is submitted to my action and I was hoping one of you could help me out. I followed Ted Husted's example of using a Multibox within an iteration but I have a feeling that my setup is a bit different and thus renders a different solution. I'm using a JSTL forEach loop to loop through a list of MessageInstance objects. I want the user to be able to check which MessageInstances should be deleted and the action to perform the deletion. Everything gets rendered ok but when the form is submitted, the String[] object in the form is empty. I should also note that everything works fine if I use an html:submit but when I try to use an html:link to do the submit I don't get any checked values in my String[] object. I've included some code snippets below. Any help would be awesome. Thanks! Ricardo JSP: === Submit Link (inside ManageNotesForm): jsp:useBean id=deleteNotesLink class= java.util.HashMap/ c:set target=${deleteNotesLink} property=membername value=${requestScope.membername}/ c:set target=${deleteNotesLink} property=task value=delete/ html:link action=/submitMain name=deleteNotesLinkdelete/html:link forEach Loop (inside ManageNotesForm): = c:forEach items=${sessionScope.messageInstances} var=aMessageInstance varStatus=status html:multibox name=${formName} property=selectedItems c:out value=${aMessageInstance.id}/ /html:multibox c:out value=${aMessageInstance.id}/ /c:forEach ManageNotesForm Bean: private String[] selectedItems = {}; public String[] getSelectedItems() { return selectedItems; } public void setSelectedItems(String[] selectedItems) { this.selectedItems = selectedItems; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ - 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]
multibox not resetting
Hello ! Multibox made me crazy !! After having each problem detailled on the mailing list i've got another not detailled... I've got a jsp page with a multibox inside an iterate. the initial display is correct and i can correctly retrieve the selected or unselected values and, then write to the database some infos. The problem is when i come back to the multibox page, the display doesn't take care of what has been changed ! Even if i call the reset method... Datas used by the reset method are correct but it seems that the multiboxes are not been replaced. The only solution i found is having a new session... where are placed the multibox ?? the form is request scoped... I've noticed that reset is called at the first generation of the form and when i leave the page but even if a forced it after i'm sure that it use correct datas, it doesn't work. The display is generated via the form's reset method with session scoped datas written in page1 (see below). how can i forcing the use of a totally new form ? Any solution ? Best regards, mathieu. scenario : page1(request on the database) --- page2 (with the multibox and writing to the database) --- page3 (confirmation and a link t page1) Here are the problem : struts-config.xml : - action path = /UnitesEnseignements type = UnitesEnseignementsAction name = UnitesEnseignementsForm scope = request validate = false input = /jsp/unitesEnseignements.jsp jsp : - logic:iterate name=unitesEnseignements scope=session id=uniteEnseignement tr td html:multibox property=valeurs bean:write name=uniteEnseignement property=temoinSession2/ /html:multibox /td tdbean:write name=uniteEnseignement property=libelle//td /tr /logic:iterate form : - public void reset(ActionMapping mapping, HttpServletRequest request) { HttpSession session = request.getSession(); ArrayList unitesEnseignements = (ArrayList)session.getAttribute(unitesEnseignements); valeurs = new String[unitesEnseignements.size()]; for(int i=0;iunitesEnseignements.size();i++) { HashMap ligne = (HashMap)unitesEnseignements.get(i); if (((String)ligne.get(temoinSession2)).equals(O)) valeurs[i] = (String)ligne.get(code); } for (int i=0;ivaleurs.length;i++) System.out.println(valeurs[i]); } }
[50% SOLVED] Resetting Multibox problems
I've found a way of bypassing the problem by using a logic:equal and logic:notEqual inside the jsp and testing my row value. This way, the display is correct... it's just not clean. New jsp : logic:equal name=uniteEnseignement property=temoinSession2 value=O input type=checkbox name=valeurs value=bean:write name=uniteEnseignement property=code/ checked=checked /logic:equal logic:notEqual name=uniteEnseignement property=temoinSession2 value=O input type=checkbox name=valeurs value=bean:write name=uniteEnseignement property=code/ /logic:notEqual Old jsp : html:multibox property=valeurs bean:write name=uniteEnseignement property=temoinSession2/ /html:multibox - Original Message - From: Mathieu Grimault [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, April 09, 2004 3:10 PM Subject: Resetting Multibox problems Re-Hello ! In addition to my question, i've seen that spy the reset() and constructor call of my actionForm : life cylcle : - constructor - first access on the jsp - reset - first access on the jsp - display of the jsp and submit - constructor - after submiting - reset - after submiting - the form is transmitted to an action who forward to another jsp Each time i came back to the jsp : - reset - each time a leave the jsp As i mention before, i used combo box. They are correctly initalised the first time but never changed whatever the reset method does (normally) and whatever is set in the String[]... Regards. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [50% SOLVED] Resetting Multibox problems
From: Mathieu Grimault [mailto:[EMAIL PROTECTED] I've found a way of bypassing the problem by using a logic:equal and logic:notEqual inside the jsp and testing my row value. This way, the display is correct... it's just not clean. You really shouldn't need to do all that. Here's a working example of multibox from my project. In my case 'accountMap' is not a form property, it's a Map sitting in session scope. I'm not sure if the code you posted is wrapped in a logic:iterate or not? Stuts will pre-select the correct checkboxes based on the values in the String[] form property. In the JSP c:forEach items=${accountMap} var=item html-el:multibox property=accounts value=${item.key}/ c:out value=${item.key}/ br/ /c:forEach The Form property is a String[]: form-bean name=accountForm type=edu.asu.vpia.struts.AccountForm form-property name=accounts type=java.lang.String[]/ /form-bean And the reset method, which only resets if the form is actually being submitted: public void reset( ActionMapping mapping, HttpServletRequest request ) { log.debug( reset: begin ); if ( request.getMethod().equals( POST ) ) { log.debug( reset: request was POSTed, resetting ); set( accounts, new String[]{} ); set( includeDetail, Boolean.FALSE ); } } I put this on my Wiki because it comes up often: http://wiki.wendysmoak.com/cgi-bin/wiki.pl?StrutsMultiBox If anyone has suggestions, just edit the page... Hope that helps! -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]