Re: Dynamic list of radio buttons
Creating the html forms itself is not a problem. However i would like to have a dynamic amount of radio button sets. So to use this radio buttons within a loop with dynamic size. So how to set the name of the radio button? For each set one value should be selected. So the name must be unique for each set. And how do I get the values of all this into my Action class? I'd prefer having a hashmap there. So the problem with the hashmap is not about the values which can be selected, but the form data being submitted. Mario Am 23.04.10 17:10, schrieb Martin Gainty: jsp hth martin -- Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Fri, 23 Apr 2010 16:32:48 -0700 From: ma...@lipinski.tk To: user@struts.apache.org Subject: Re: Dynamic list of radio buttons Hi, thank you for your reply. Taking your comments I ended with the following jsp code: Having for example two datasets in results, I can only select one radio button (because the name has no dynamic component in the name). I tried something like name="rating[%{id}]" but I fail to get these parameters set in my Action class. com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression 'rating[1]' with value '[Ljava.lang.String;@6ae7c6d1' ognl.OgnlException: target is null for setProperty(null, "1", [Ljava.lang.String;@6ae7c6d1) How do the set-methods for this have to look like? I'd prefer having a HashMap with the key set by the id from the result and the value from the radio button. Mario Am 23.04.10 16:10, schrieb Martin Gainty: Date: Fri, 23 Apr 2010 15:55:52 -0700 From: ma...@lipinski.tk To: user@struts.apache.org Subject: Dynamic list of radio buttons Hello, I am wondering how to create a dynamic form containing a set of radio buttons. So I have an iterable list of database results. Any of the results should be rated using radio buttons. When the form is submitted I want to have a hashmap with an id as the key and the value selected with the radio buttons as value. How can I achieve this using struts2 and jsp? Mario _ The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5 -- Mit freundlichen Grüßen Mario Lipinski Telefon: +49-531-128 Heinrich-Büssing-Ring 4 Mobil: +49-171-4483626 38102 Braunschweig Fax: +49-3212-1132359 E-Mail: ma...@lipinski.tk smime.p7s Description: S/MIME Cryptographic Signature
RE: Setting selected with s:select tags
Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Fri, 23 Apr 2010 17:11:24 -0700 > Subject: Setting selected with s:select tags > From: krishnan.1...@gmail.com > To: user@struts.apache.org > > Hi Struts gurus, > > I am have an object level attribute that is selected from the s:select tag. > > list="#{'': 'Select One', 'bean.attributeValue':'bean.attributeValue', > 'abc':'abc'}" > required="true" onchange="showSearchCriterionField()" /> > > If I want to set 'abc' to selected, then how do do that ? Any advice would > be welcome. > > Thanks, > > Kartik _ The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
Re: Setting selected with s:select tags
Hi Kartik, Remove the attribute value from your s:select tag, and in your action, preset the value of your attribute actionStatus (on your Action class) to "OPEN" or "CLOSED". At least, it is working in my case. Let us know if it is not working for you that way, and I will put together a simple example showcasing this. Denis Le 2010-04-23 20:37, Kartik Kumar a écrit : I have some thing like this ** Change But I don't see the preselected value, Thanks, Kartik On Fri, Apr 23, 2010 at 5:11 PM, Kartik Kumarwrote: Hi Struts gurus, I am have an object level attribute that is selected from the s:select tag. If I want to set 'abc' to selected, then how do do that ? Any advice would be welcome. Thanks, Kartik - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org