RE: html:options selected
Hi Søren, Should work, note the added: value="c_stand" in the For additional info, see: http://struts.apache.org/1.x/struts-taglib/tlddoc/html/select.html Or for 2.x: http://struts.apache.org/WW/select.html Regards Thor > -Original Message- > From: Søren Blidorf [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 15, 2006 12:24 PM > To: 'Struts Users Mailing List' > Subject: SV: html:options selected > > Hi Mano. > > Thanks for your help > > Could you explain it again. > > I am not sure I understand... > > C_stand already has the value of "test2", and still it is not > selected. > > -Oprindelig meddelelse- > Fra: Mano Chinthaka Dasanayaka [mailto:[EMAIL PROTECTED] > Sendt: 15. november 2006 12:18 > Til: 'Struts Users Mailing List' > Emne: RE: html:options selected > > Yes u can...just set the value of c_stand to value "test2" in action > class.. where u load this page...then it shud work.. > > > Regards, > Mano > > -Original Message- > From: Søren Blidorf [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 15, 2006 4:27 PM > To: Struts Users Mailing List > Subject: html:options selected > > Hi. > > I am trying to get html:select to work for my purpose. > > Can anybody help me.. > > c_stand is a String value from PeopleBean in > request.getAttribute("people"); cs is a collection containing > values in OptionValueBean. > > If cs contains values test1, test2 and test3 and c_stand > contains test2 I want test2 to be selected in the html:select > > Is that possible? > > name="element" id="c_stand" property="c_stand" /> > > > labelProperty="option"/> > > > > > > - > 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: html:options selected
You can do it like this : Where cs is your list of values. The above will make the "test2" as the first option in the list, which is selected by default. -Original Message- From: Søren Blidorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 15, 2006 12:57 PM To: Struts Users Mailing List Subject: html:options selected Hi. I am trying to get html:select to work for my purpose. Can anybody help me.. c_stand is a String value from PeopleBean in request.getAttribute("people"); cs is a collection containing values in OptionValueBean. If cs contains values test1, test2 and test3 and c_stand contains test2 I want test2 to be selected in the html:select Is that possible? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options selected
Yes u can...just set the value of c_stand to value "test2" in action class.. where u load this page...then it shud work.. Regards, Mano -Original Message- From: Søren Blidorf [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 15, 2006 4:27 PM To: Struts Users Mailing List Subject: html:options selected Hi. I am trying to get html:select to work for my purpose. Can anybody help me.. c_stand is a String value from PeopleBean in request.getAttribute("people"); cs is a collection containing values in OptionValueBean. If cs contains values test1, test2 and test3 and c_stand contains test2 I want test2 to be selected in the html:select Is that possible? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options Hashtable
Hi, I think you can, according to the tag code it is possible, but i havent tried it, give it a try. Thanks, Nuwna On 9/4/06, chamal desilva <[EMAIL PROTECTED]> wrote: Hi, Can we display the values of a hashtable in a html drop down menu using struts tags. Thanking You, Chamal. __ 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]
re: re: re: html:options collection design question
I am not sure if there's better idea than writing your own JavaScript to do that.. Stanislav <[EMAIL PROTECTED]> : Hi! That is fine if i want to set bgcolor to ALL text, but i want to set different bgcolor for different choices in drop down menu. Tnx, Stanislav - Original Message Follows - > maybe css would be one solution, edit your css class, and use "styleClass" > attribute to ref it > > > > Stanislav 写道: Hi! > > I want to set background color in drop down menu that is generated with > html:options collection. > Is there any way to do that? > > Here is code sample: > > > > > > Tnx, > Stanislav > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > 雅虎免费邮箱-3.5G容量,20M附件 > 雅虎助手-搜索、杀毒、防骚扰 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 抢注雅虎免费邮箱-3.5G容量,20M附件!
re: html:options collection design question
maybe css would be one solution, edit your css class, and use "styleClass" attribute to ref it Stanislav <[EMAIL PROTECTED]> 写道: Hi! I want to set background color in drop down menu that is generated with html:options collection. Is there any way to do that? Here is code sample: Tnx, Stanislav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 雅虎免费邮箱-3.5G容量,20M附件 雅虎助手-搜索、杀毒、防骚扰
Re: html:options whith a HashMap
José María Tristán wrote: I create a bean: public class BeanDatos { private Map codigoM = new HashMap(); public Map getCodigoM(){ return this.codigoM; } public void setCodigoM(Map codigoM){ this.codigoM = codigoM; } } And in my jsp: <% BeanDatos hashMapBean = new BeanDatos(); Map mapa = new HashMap(); mapa.put("100","SEDA"); mapa.put("101","LIOFI"); mapa.put("102","Cogeneracion"); hashMapBean.setCodigoM(mapa); pageContext.setAttribute("hashMapBean",hashMapBean); %> and i received the next message: Well your html:options is pointing to a bean named 'hashMapBean' which is of type BeanDatos. BeanDatos doesn't have getters named getKey() and getValue(). What you probably meant was L. javax.servlet.ServletException: No getter method available for property codigoM for bean under name null org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContext Impl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextIm pl.java:758) org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:178) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) causa raíz javax.servlet.jsp.JspException: No getter method available for property codigoM for bean under name null org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:382) org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:246) org.apache.jsp.pages.submit_jsp._jspx_meth_html_options_0(submit_jsp.java:6 84) org.apache.jsp.pages.submit_jsp._jspx_meth_html_select_2(submit_jsp.java:65 5) org.apache.jsp.pages.submit_jsp._jspx_meth_html_form_0(submit_jsp.java:250) org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:168) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) Thank you. -Mensaje original- De: Aidas Semezys [mailto:[EMAIL PROTECTED] Enviado el: jueves, 09 de febrero de 2006 15:05 Para: Struts Users Mailing List Asunto: Re: html:options whith a HashMap Yes it is possible. Suppose you have bean of type java.util.HashMap in your context under name hashMapBean. Then you write: That's all for it. On 2/8/06, José María Tristán <[EMAIL PROTECTED]> wrote: Hi, I have an application whith a html:options whith two ArrayList to see the "name"(arrayCodigo) and the "label" (arrayDescripcion) Is possible do the same whith a HashMap (key-value)?. How i say to html:options that the property name is the key of HashMap and the labelname is the value of HashMap. Thank you very much - 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: html:options whith a HashMap
I create a bean: public class BeanDatos { private Map codigoM = new HashMap(); public Map getCodigoM(){ return this.codigoM; } public void setCodigoM(Map codigoM){ this.codigoM = codigoM; } } And in my jsp: <% BeanDatos hashMapBean = new BeanDatos(); Map mapa = new HashMap(); mapa.put("100","SEDA"); mapa.put("101","LIOFI"); mapa.put("102","Cogeneracion"); hashMapBean.setCodigoM(mapa); pageContext.setAttribute("hashMapBean",hashMapBean); %> and i received the next message: javax.servlet.ServletException: No getter method available for property codigoM for bean under name null org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContext Impl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextIm pl.java:758) org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:178) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) causa raíz javax.servlet.jsp.JspException: No getter method available for property codigoM for bean under name null org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:382) org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:246) org.apache.jsp.pages.submit_jsp._jspx_meth_html_options_0(submit_jsp.java:6 84) org.apache.jsp.pages.submit_jsp._jspx_meth_html_select_2(submit_jsp.java:65 5) org.apache.jsp.pages.submit_jsp._jspx_meth_html_form_0(submit_jsp.java:250) org.apache.jsp.pages.submit_jsp._jspService(submit_jsp.java:168) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 298) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) Thank you. -Mensaje original- De: Aidas Semezys [mailto:[EMAIL PROTECTED] Enviado el: jueves, 09 de febrero de 2006 15:05 Para: Struts Users Mailing List Asunto: Re: html:options whith a HashMap Yes it is possible. Suppose you have bean of type java.util.HashMap in your context under name hashMapBean. Then you write: That's all for it. On 2/8/06, José María Tristán <[EMAIL PROTECTED]> wrote: > > Hi, > > I have an application whith a html:options whith two ArrayList to > see the > "name"(arrayCodigo) and the "label" (arrayDescripcion) > > labelName="arrayDescripcion" /> > > > Is possible do the same whith a HashMap (key-value)?. How i say > to > html:options that the property name is the key of HashMap and the > labelname > is the value of HashMap. > > Thank you very much > > > - > 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: html:options whith a HashMap
Yes it is possible. Suppose you have bean of type java.util.HashMap in your context under name hashMapBean. Then you write: That's all for it. On 2/8/06, José María Tristán <[EMAIL PROTECTED]> wrote: > > Hi, > > I have an application whith a html:options whith two ArrayList to > see the > "name"(arrayCodigo) and the "label" (arrayDescripcion) > > labelName="arrayDescripcion" /> > > > Is possible do the same whith a HashMap (key-value)?. How i say > to > html:options that the property name is the key of HashMap and the > labelname > is the value of HashMap. > > Thank you very much > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
RE: html:options
Viniciius, Here is a link to the options user guide secition of the Struts user guide: http://struts.apache.org/userGuide/struts-html.html#options Look at the LabelName and LabelProprety attributes. * Ruben Cepeda [EMAIL PROTECTED] * Original Message Follows From: Vinicius Caldeira Carvalho <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" To: Struts Users Mailing List Subject: html:options Date: Sat, 09 Apr 2005 09:49:15 -0300 Hello there! I've always used the with the collection attribute, so I had a separate bean with the collection. But now I'd like to have that collection on my form bean cuz it'll be stored on the session, and I have a utility filter that always remove my formbeans stored on the session after the end of an usercase. So for this specific case, having the collection inside my form seemed to be the best solution since I don't need to care about that bean later. Ok. But for my surprise struts lacks support for collections insides the formbeans This prints documenttype as value and property, but I'd like to have a way to say which accessor is my label and which is property. Isn't this possible? - 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: html:options
I am using a LazyValidatorForm as my backing bean. I assumed that it would be able to handle them automatically, but you got me to thinking. I added in the String[] declaration and it works great. --- Eddie Bush <[EMAIL PROTECTED]> wrote: > Are you getting any interesting debug statements? > > Looks to me like the form should be properly populated, even > if > validation failed. What type of field are the values being > put into? > If you're looking for multiples, I imagine you're putting them > into a > String array? = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ 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]
Re: html:options
Are you getting any interesting debug statements? Looks to me like the form should be properly populated, even if validation failed. What type of field are the values being put into? If you're looking for multiples, I imagine you're putting them into a String array? Please trim unnecessary dialog out of messages when posting a response. On Fri, 28 Jan 2005 17:59:16 -0800 (PST), Norris Shelton <[EMAIL PROTECTED]> wrote: > That was it exactly. Thx. > > Now I have another question. My box is a multi select. If > there is a validation error, only the first option will still be > selected. -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
That was it exactly. Thx. Now I have another question. My box is a multi select. If there is a validation error, only the first option will still be selected. --- Kishore Senji <[EMAIL PROTECTED]> wrote: > On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton > <[EMAIL PROTECTED]> wrote: > > Here is what I have in the JSP tag file: > > > >> multiple="true"> > > > labelProperty="description" /> > > collection attribute takes a name which holds the Collection > and not > the collection itself. Assuming that your list is set under > the name > "state", your collection attribute should be > collection="state" and > not collection="${state}" > > > > > > > > > state is a simple tag that makes a List of State objects > > available to the page. I tried setting them as a page scope > > attribute and a request scope attribute. I always get the > > following message: > > > > javax.servlet.jsp.JspException: Cannot find bean under name > > [EMAIL PROTECTED], > > [EMAIL PROTECTED], > > [EMAIL PROTECTED], > > [EMAIL PROTECTED], > > [EMAIL PROTECTED], > > [EMAIL PROTECTED], > > [EMAIL PROTECTED], > > [EMAIL PROTECTED] > > > > = > > > > Norris Shelton > > Software Engineer > > Sun Certified Java 1.1 Programmer > > Appriss, Inc. > > ICQ# 26487421 > > AIM NorrisEShelton > > YIM norrisshelton > > > > __ > > Do you Yahoo!? > > Yahoo! Mail - now with 250MB free storage. Learn more. > > http://info.mail.yahoo.com/mail_250 > > > > > - > > 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] > > = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
The ${formName} is in fact a variable that holds the name of the form. Kishore Senji's solution was what I needed. --- Eddie Bush <[EMAIL PROTECTED]> wrote: > Seems to me you have the form name incorrect? is 'formName' > the name > of the form, or is it a String holding the name of the form? > > I think you'd find it easier to populate your list in an > action. > > Perhaps you meant to put: > > multiple="true"> > > If "formName" (above) is the name of your form, I think this > is what > you're aiming for. Otherwise, supposing you're using the > html-el > tags, you're going to wind up with the value of the variable > "formName" (presumably an object) evaluated as a String ... > which > probably isn't what you're after. > > HTH > > On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton > <[EMAIL PROTECTED]> wrote: > > javax.servlet.jsp.JspException: Cannot find bean under name > > -- > Eddie Bush > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > = Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Appriss, Inc. ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton __ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton <[EMAIL PROTECTED]> wrote: > Here is what I have in the JSP tag file: > >multiple="true"> > labelProperty="description" /> collection attribute takes a name which holds the Collection and not the collection itself. Assuming that your list is set under the name "state", your collection attribute should be collection="state" and not collection="${state}" > > > > state is a simple tag that makes a List of State objects > available to the page. I tried setting them as a page scope > attribute and a request scope attribute. I always get the > following message: > > javax.servlet.jsp.JspException: Cannot find bean under name > [EMAIL PROTECTED], > [EMAIL PROTECTED], > [EMAIL PROTECTED], > [EMAIL PROTECTED], > [EMAIL PROTECTED], > [EMAIL PROTECTED], > [EMAIL PROTECTED], > [EMAIL PROTECTED] > > = > > Norris Shelton > Software Engineer > Sun Certified Java 1.1 Programmer > Appriss, Inc. > ICQ# 26487421 > AIM NorrisEShelton > YIM norrisshelton > > __ > Do you Yahoo!? > Yahoo! Mail - now with 250MB free storage. Learn more. > http://info.mail.yahoo.com/mail_250 > > - > 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: html:options
Sorry for the double post. G-Mail hiccuped. -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
Seems to me you have the form name incorrect? is 'formName' the name of the form, or is it a String holding the name of the form? I think you'd find it easier to populate your list in an action. Perhaps you meant to put: If "formName" (above) is the name of your form, I think this is what you're aiming for. Otherwise, supposing you're using the html-el tags, you're going to wind up with the value of the variable "formName" (presumably an object) evaluated as a String ... which probably isn't what you're after. HTH On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton <[EMAIL PROTECTED]> wrote: > javax.servlet.jsp.JspException: Cannot find bean under name -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options
Seems to me you have the form name incorrect? is 'formName' the name of the form, or is it a String holding the name of the form? I think you'd find it easier to populate your list in an action. Perhaps you meant to put: If "formName" (above) is the name of your form, I think this is what you're aiming for. Otherwise, supposing you're using the html-el tags, you're going to wind up with the value of the variable "formName" (presumably an object) evaluated as a String ... which probably isn't what you're after. HTH, Eddie On Fri, 28 Jan 2005 16:53:16 -0800 (PST), Norris Shelton <[EMAIL PROTECTED]> wrote: > javax.servlet.jsp.JspException: Cannot find bean under name -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options won't get preselected!
You are right! It was the key against the name. Thank you so much. Nadia -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Thursday, December 30, 2004 11:20 AM To: Struts Users Mailing List Subject: Re: html:options won't get preselected! From: "Nadia Kunkov" <[EMAIL PROTECTED]> > > > Struts will pre-select the item when the 'country' property of the form matches the countryID of the option. What is the exact value of the 'country' property of the form? I'm betting you've got 'Canada' when you need 'CAN'. -- Wendy Smoak - 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: html:options won't get preselected!
From: "Nadia Kunkov" <[EMAIL PROTECTED]> > > > Struts will pre-select the item when the 'country' property of the form matches the countryID of the option. What is the exact value of the 'country' property of the form? I'm betting you've got 'Canada' when you need 'CAN'. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options and collections
Erik Weber writes: > I often write a Struts plug-in that sets static collections (such as > select box values) as ServletContext attributes in the init method. That becomes more complicated when you handle i18n (e.g. in labelProperty). -- Guillaume Cottenceau - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options and collections
[EMAIL PROTECTED] wrote: I want to use a bean to supply options to a select widget. I have a business object, DevicesBO that has a method that returns a Collection. Class Name: DevicesBO Method: Collection getDevices() The collection is a List of CodeDecodeDTO objects. Class Name: CodeDecodeDTO Methods:String getCode() String getDecodeDesc() The value should be retrieved using the getCode() method and the label should be retrieved using getDecodeDesc. I've tried with no success to setup my JSP, below is what I've tried. snippet from my struts-config.xml ... ... ... ... ... ... snippet from my JSP ... ... /> ... ... From the documentation for html:options: The *property* attribute is interpreted as the name of a property of the individual beans included in the collection, and is used to retrieve the value that will be returned to the server if this option is selected. Since your methods are getCode and getDecodeDesc, your property names would be "code" and "decodeDesc". So it should be property="code" and labelProperty="decodeDesc" if I'm not mistaken. What is the correct way to setup the html:options tag? Is there a way to use OSCache tags so I can cache the DevicesBO in my application? I often write a Struts plug-in that sets static collections (such as select box values) as ServletContext attributes in the init method. Erik Thanks, James - 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: html:options Help
Thanks for the Reply Amar ! See, I have a property called 'availableFunds' in my ActionForm(named myForm) and a getAvailableFunds() which returns an ArrayList. Now if I want to populate my ListBox using the same logic, this is what should be doing. Please validate if I'm thinking on the correct lines : Please let me know if my approach is correct. Also am confused as to what would be the property in TIA, Priya -Original Message- From: Jirole, Amar [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 7:03 PM To: 'Struts Users Mailing List' Subject: RE: html:options Help Here is sample usage for Country drop down. Where countryId is property on you form, countryOptions is bean name which holds collection of objects of class country with properties id and name. HTH -Amar -Original Message- From: Priya Jotwani [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 7:14 AM To: Struts Users Mailing List Subject: RE: html:options Help I have seen the Struts Documentation for the same but couldn't really gather much !! Can someone give me an example of using TIA, Priya -Original Message- From: Priya Jotwani Sent: Wednesday, September 15, 2004 8:27 PM To: [EMAIL PROTECTED] Subject: html:options Help Can somebody give me an example of how to use for populating my Listbox with the values returned by getFundlist() of my ActionForm ? TIA, Priya - 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: html:options Help
Here is sample usage for Country drop down. Where countryId is property on you form, countryOptions is bean name which holds collection of objects of class country with properties id and name. HTH -Amar -Original Message- From: Priya Jotwani [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 7:14 AM To: Struts Users Mailing List Subject: RE: html:options Help I have seen the Struts Documentation for the same but couldn't really gather much !! Can someone give me an example of using TIA, Priya -Original Message- From: Priya Jotwani Sent: Wednesday, September 15, 2004 8:27 PM To: [EMAIL PROTECTED] Subject: html:options Help Can somebody give me an example of how to use for populating my Listbox with the values returned by getFundlist() of my ActionForm ? TIA, Priya - 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: html:options Help
I have seen the Struts Documentation for the same but couldn't really gather much !! Can someone give me an example of using TIA, Priya -Original Message- From: Priya Jotwani Sent: Wednesday, September 15, 2004 8:27 PM To: [EMAIL PROTECTED] Subject: html:options Help Can somebody give me an example of how to use for populating my Listbox with the values returned by getFundlist() of my ActionForm ? TIA, Priya - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options Help
Have you tried http://struts.apache.org/userGuide/dev_html.html? -Original Message- From: Priya Jotwani [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 10:57 AM To: [EMAIL PROTECTED] Subject: html:options Help Can somebody give me an example of how to use for populating my Listbox with the values returned by getFundlist() of my ActionForm ? TIA, Priya - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:options tag with ArrayList of Strings
Yes, U can do that -Original Message- From: Nestor Boscan [mailto:[EMAIL PROTECTED] Sent: Friday, May 28, 2004 10:23 AM To: [EMAIL PROTECTED] Subject: html:options tag with ArrayList of Strings Hi I'm working with the html:select and html:options tag and wanted to know if I can create a list box based on an ArrayList that contains Strings. Thanks in advance - 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: html:options tag with ArrayList of Strings
Yes, you can do it. Btw, you can do the same thing using Vectors too. > -Original Message- > From: Nestor Boscan [mailto:[EMAIL PROTECTED] > Sent: Friday, May 28, 2004 7:53 AM > To: [EMAIL PROTECTED] > Subject: html:options tag with ArrayList of Strings > > Hi > > I'm working with the html:select and html:options tag and > wanted to know if I can create a list box based on an > ArrayList that contains Strings. > > Thanks in advance > > > > > - > 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]