RE: html:options and html:select
If your list stores objects which is the type of Struts' LabelValueBean (provides only getValue() and getLabel() methods), then you can simply as Jiin-Her Lu (816) 926-2145 >>> [EMAIL PROTECTED] 02/02/04 06:31AM >>> Hi Frank Try using Request.setAttribute("collectionName",list); I have tried putting the Collection as the request attribute never in the form bean. One more thing make user you provide exact path of CProduct in the name field. Regards Anant -Original Message- From: Otto, Frank [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 5:41 PM To: Struts-User (E-Mail) Subject: html:options and html:select hello, I have following bean: public class CProduct { private Integer id; private String name public Integer getId() {return id;} puclic void setId(Integer id){ ... } My form class contains a java.util.List of CProduct bean. How can I display the List as select box? I want to use the id as value and the name as label of the select box. For example: scanner harddisk Has anyone an idea? Regards, Frank Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - 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 and html:select
Otto, you can take a look at http://providers.sourceforge.net/, this project can help you in filling options in selects. There is a 0.1 version, butwe are working in 0.2 with a lot of improvements. Cheers. Guillermo. -Original Message- From: Otto, Frank [mailto:[EMAIL PROTECTED] Sent: Lunes, 02 de Febrero de 2004 09:28 a.m. To: 'Struts Users Mailing List' Subject: AW: html:options and html:select Thanks for your answer, but I have found out, that I can use html:optionsCollection. Regards, Frank -Ursprüngliche Nachricht- Von: Claire Wall [mailto:[EMAIL PROTECTED] Gesendet: Montag, 2. Februar 2004 13:22 An: Struts Users Mailing List Betreff: Re: html:options and html:select you can do the following: "> 'property' of the select box should be the name of the property in your FormBean that you wish to store the selected value in. You then iterate through the list in your form by using the tag. For every object in your list an tag is written, where the value is the property 'id' of the current CProduct and the name displayed in the select box is the name of this CProduc object. This may not work as it stands due to using an Integer object - i'm not certain that you can set the value of a select box option to an Integer object. You'd have to try it and see, and perhaps somebody can clarify this further, but I've never tried this myself. HTH claire :) - Original Message - From: "Otto, Frank" <[EMAIL PROTECTED]> To: "Struts-User (E-Mail)" <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 12:11 PM Subject: html:options and html:select > hello, > > I have following bean: > > public class CProduct { > > private Integer id; > > private String name > > public Integer getId() {return id;} > puclic void setId(Integer id){ > ... > } > > My form class contains a java.util.List of CProduct bean. > > How can I display the List as select box? I want to use the id as > value and the name as label of the select box. > > For example: > > > scanner > harddisk > > > Has anyone an idea? > > Regards, > > Frank > > - 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] 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]
Re: AW: html:options and html:select
Aha! i use the bean:write's but then i like doing things the complicated way. Never used the html:options in this situation before so thanks for the tip - will make things much easier! cw :) - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 12:34 PM Subject: Re: AW: html:options and html:select Thank goodness for that, dunno why folks seem to do that bean:write for dropdowns :o) On 2 Feb 2004, at 13:27, Otto, Frank wrote: > Thanks for your answer, but > > I have found out, that I can use html:optionsCollection. > > > value="id" label="name"/> > > > Regards, > > Frank > > -Ursprüngliche Nachricht- > Von: Claire Wall [mailto:[EMAIL PROTECTED] > Gesendet: Montag, 2. Februar 2004 13:22 > An: Struts Users Mailing List > Betreff: Re: html:options and html:select > > > you can do the following: > > > > property="id"/>"> > > > > > 'property' of the select box should be the name of the property in your > FormBean that you wish to store the selected value in. > You then iterate through the list in your form by using the > > tag. For every object in your list an tag is written, where > the > value is the property 'id' of the current CProduct and the name > displayed in > the select box is the name of this CProduc object. This may not work > as it > stands due to using an Integer object - i'm not certain that you can > set the > value of a select box option to an Integer object. You'd have to try > it and > see, and perhaps somebody can clarify this further, but I've never > tried > this myself. > > HTH > claire :) > > - Original Message - > From: "Otto, Frank" <[EMAIL PROTECTED]> > To: "Struts-User (E-Mail)" <[EMAIL PROTECTED]> > Sent: Monday, February 02, 2004 12:11 PM > Subject: html:options and html:select > > >> hello, >> >> I have following bean: >> >> public class CProduct { >> >> private Integer id; >> >> private String name >> >> public Integer getId() {return id;} >> puclic void setId(Integer id){ >> ... >> } >> >> My form class contains a java.util.List of CProduct bean. >> >> How can I display the List as select box? I want to use the id as >> value > and the name as label of the select box. >> >> For example: >> >> >> scanner >> harddisk >> >> >> Has anyone an idea? >> >> Regards, >> >> Frank >> >> > > > > - > 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: AW: html:options and html:select
Thank goodness for that, dunno why folks seem to do that bean:write for dropdowns :o) On 2 Feb 2004, at 13:27, Otto, Frank wrote: Thanks for your answer, but I have found out, that I can use html:optionsCollection. Regards, Frank -Ursprüngliche Nachricht- Von: Claire Wall [mailto:[EMAIL PROTECTED] Gesendet: Montag, 2. Februar 2004 13:22 An: Struts Users Mailing List Betreff: Re: html:options and html:select you can do the following: "> 'property' of the select box should be the name of the property in your FormBean that you wish to store the selected value in. You then iterate through the list in your form by using the tag. For every object in your list an tag is written, where the value is the property 'id' of the current CProduct and the name displayed in the select box is the name of this CProduc object. This may not work as it stands due to using an Integer object - i'm not certain that you can set the value of a select box option to an Integer object. You'd have to try it and see, and perhaps somebody can clarify this further, but I've never tried this myself. HTH claire :) - Original Message - From: "Otto, Frank" <[EMAIL PROTECTED]> To: "Struts-User (E-Mail)" <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 12:11 PM Subject: html:options and html:select hello, I have following bean: public class CProduct { private Integer id; private String name public Integer getId() {return id;} puclic void setId(Integer id){ ... } My form class contains a java.util.List of CProduct bean. How can I display the List as select box? I want to use the id as value and the name as label of the select box. For example: scanner harddisk Has anyone an idea? Regards, Frank - 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 and html:select
Hi Frank Try using Request.setAttribute("collectionName",list); I have tried putting the Collection as the request attribute never in the form bean. One more thing make user you provide exact path of CProduct in the name field. Regards Anant -Original Message- From: Otto, Frank [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 5:41 PM To: Struts-User (E-Mail) Subject: html:options and html:select hello, I have following bean: public class CProduct { private Integer id; private String name public Integer getId() {return id;} puclic void setId(Integer id){ ... } My form class contains a java.util.List of CProduct bean. How can I display the List as select box? I want to use the id as value and the name as label of the select box. For example: scanner harddisk Has anyone an idea? Regards, Frank Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: html:options and html:select
Thanks for your answer, but I have found out, that I can use html:optionsCollection. Regards, Frank -Ursprüngliche Nachricht- Von: Claire Wall [mailto:[EMAIL PROTECTED] Gesendet: Montag, 2. Februar 2004 13:22 An: Struts Users Mailing List Betreff: Re: html:options and html:select you can do the following: "> 'property' of the select box should be the name of the property in your FormBean that you wish to store the selected value in. You then iterate through the list in your form by using the tag. For every object in your list an tag is written, where the value is the property 'id' of the current CProduct and the name displayed in the select box is the name of this CProduc object. This may not work as it stands due to using an Integer object - i'm not certain that you can set the value of a select box option to an Integer object. You'd have to try it and see, and perhaps somebody can clarify this further, but I've never tried this myself. HTH claire :) - Original Message - From: "Otto, Frank" <[EMAIL PROTECTED]> To: "Struts-User (E-Mail)" <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 12:11 PM Subject: html:options and html:select > hello, > > I have following bean: > > public class CProduct { > > private Integer id; > > private String name > > public Integer getId() {return id;} > puclic void setId(Integer id){ > ... > } > > My form class contains a java.util.List of CProduct bean. > > How can I display the List as select box? I want to use the id as value and the name as label of the select box. > > For example: > > > scanner > harddisk > > > Has anyone an idea? > > Regards, > > Frank > > - 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 and html:select
ArrayList productList = new ArrayList(); CProduct product = new CProduct(); product.setId(new Integer(1)); product.setName("My Product"); productList.add(product); request.setAttribute("products",productList.toArray()); ... -- If you dont want to have a refering action then you can have an action that returns null rather than a forward. and do this in jstl Cheers Mark On 2 Feb 2004, at 13:11, Otto, Frank wrote: hello, I have following bean: public class CProduct { private Integer id; private String name public Integer getId() {return id;} puclic void setId(Integer id){ ... } My form class contains a java.util.List of CProduct bean. How can I display the List as select box? I want to use the id as value and the name as label of the select box. For example: scanner harddisk Has anyone an idea? Regards, Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:options and html:select
you can do the following: "> 'property' of the select box should be the name of the property in your FormBean that you wish to store the selected value in. You then iterate through the list in your form by using the tag. For every object in your list an tag is written, where the value is the property 'id' of the current CProduct and the name displayed in the select box is the name of this CProduc object. This may not work as it stands due to using an Integer object - i'm not certain that you can set the value of a select box option to an Integer object. You'd have to try it and see, and perhaps somebody can clarify this further, but I've never tried this myself. HTH claire :) - Original Message - From: "Otto, Frank" <[EMAIL PROTECTED]> To: "Struts-User (E-Mail)" <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 12:11 PM Subject: html:options and html:select > hello, > > I have following bean: > > public class CProduct { > > private Integer id; > > private String name > > public Integer getId() {return id;} > puclic void setId(Integer id){ > ... > } > > My form class contains a java.util.List of CProduct bean. > > How can I display the List as select box? I want to use the id as value and the name as label of the select box. > > For example: > > > scanner > harddisk > > > Has anyone an idea? > > Regards, > > Frank > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:options and html:select
hello, I have following bean: public class CProduct { private Integer id; private String name public Integer getId() {return id;} puclic void setId(Integer id){ ... } My form class contains a java.util.List of CProduct bean. How can I display the List as select box? I want to use the id as value and the name as label of the select box. For example: scanner harddisk Has anyone an idea? Regards, Frank