RE: html:select question
Hi Paul, Your question seems very similar to my post last week. I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: For this you can set the attribute in your form class and when you use html:selectin your jsp, while populating the options in the drop down, struts will automatically select the dafult predetermined option and show it as selected. (See vincent and robert's posts). Let me know if that helps! (I did try the same logic and when i give system.out in my jsp, it is identifying the correct default value-only that I cant see the option selected.let me know if yours works from these hints. That would help me too) :-))) Thanks, Sam. Au-Yeung, Stella H [EMAIL PROTECTED] wrote: I see. I'll try that tomorrow and let you know. Thx. -Original Message- From: Paul Stanton [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 09, 2004 12:05 AM To: Struts Users Mailing List Subject: Re: question the most simplest solution is often the best Au-Yeung, Stella H wrote: Paul wrote: labelProperty=name/ No I don't know how to try yours because I don't see how the above statement tells it to compare userId with person.id and then store the value into person.id. In other words, I don't know how to convert my statement below to yours: collection=uList name=UserFormBean property=userId labelproperty=commonName/ -Original Message- From: Paul Stanton [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: Re: question i think you are trying to do the following... labelProperty=name/ this is assuming uList is a list of beans with id/name fields and your form has a userId field. Au-Yeung, Stella H wrote: Hi: I need to set a pre-defined option in using the value= attribute, I thought the following will work: collection=uList name=UserFormBean property=userId labelproperty=commonName/ I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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] - Do you Yahoo!? Yahoo! Search - Find what youre looking for faster.
html:select question
Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select question
i think you are trying to do the following... html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select this is assuming uList is a list of beans with id/name fields and your form has a userId field. Au-Yeung, Stella H wrote: Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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:select question
Try something like this, bean:define id=uList name=UserFormBean property=userList/ bean;define id=person name=person.id / html:select property=person.id value=%=person% html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select The value attribute is RT-Exp, and not name of a bean. hth -jayash -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 3:38 PM To: '[EMAIL PROTECTED]' Subject: html:select question Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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:select question
I got a compilation errror after I changed to using %= %: Here's my error: cannot resolve symbol probably occurred due to an error in /app/fdd/shopWorkOrder/CreateShopWorkOrder.jsp line 92: html:select property=shopWorkOrder.engineerId value=%=shopWorkOrder.engineerId% My actual segment of JSP: bean:define id=eList name=ShopWorkOrderFormBean property=engineerList/ html:select property=shopWorkOrder.engineerId value=%=shopWorkOrder.engineerId% html:options collection=eList name=ShopWorkOrderFormBean property=userId labelproperty=commonName/ /html:select engineerId is an attribute in the dataBean shopWorkOrder. Can't I reference shopWorkOrder.engineerId inside the %= %? I want to compare value of userId in the collection with shopWorkOrder.engineerId. -Original Message- From: Gopalakrishnan, Jayesh [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: RE: html:select question Try something like this, bean:define id=uList name=UserFormBean property=userList/ bean;define id=person name=person.id / html:select property=person.id value=%=person% html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select The value attribute is RT-Exp, and not name of a bean. hth -jayash -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 3:38 PM To: '[EMAIL PROTECTED]' Subject: html:select question Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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:select question
did you try mine? Au-Yeung, Stella H wrote: I got a compilation errror after I changed to using %= %: Here's my error: cannot resolve symbol probably occurred due to an error in /app/fdd/shopWorkOrder/CreateShopWorkOrder.jsp line 92: html:select property=shopWorkOrder.engineerId value=%=shopWorkOrder.engineerId% My actual segment of JSP: bean:define id=eList name=ShopWorkOrderFormBean property=engineerList/ html:select property=shopWorkOrder.engineerId value=%=shopWorkOrder.engineerId% html:options collection=eList name=ShopWorkOrderFormBean property=userId labelproperty=commonName/ /html:select engineerId is an attribute in the dataBean shopWorkOrder. Can't I reference shopWorkOrder.engineerId inside the %= %? I want to compare value of userId in the collection with shopWorkOrder.engineerId. -Original Message- From: Gopalakrishnan, Jayesh [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: RE: html:select question Try something like this, bean:define id=uList name=UserFormBean property=userList/ bean;define id=person name=person.id / html:select property=person.id value=%=person% html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select The value attribute is RT-Exp, and not name of a bean. hth -jayash -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 3:38 PM To: '[EMAIL PROTECTED]' Subject: html:select question Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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: html:select question
engineerId is an attribute in the dataBean shopWorkOrder. Can't I reference shopWorkOrder.engineerId inside the %= %? I guess shopWorkOrder is the attribute name of the bean. The %= % should contain a java expression. Use the bean:define to define a JSP variable and use it in %= % bean:define id=engineerId name=shopWorkOrder property=engineerId / then use %=engineerId% in the html:select. -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 4:49 PM To: 'Struts Users Mailing List' Subject: RE: html:select question I got a compilation errror after I changed to using %= %: Here's my error: cannot resolve symbol probably occurred due to an error in /app/fdd/shopWorkOrder/CreateShopWorkOrder.jsp line 92: html:select property=shopWorkOrder.engineerId value=%=shopWorkOrder.engineerId% My actual segment of JSP: bean:define id=eList name=ShopWorkOrderFormBean property=engineerList/ html:select property=shopWorkOrder.engineerId value=%=shopWorkOrder.engineerId% html:options collection=eList name=ShopWorkOrderFormBean property=userId labelproperty=commonName/ /html:select engineerId is an attribute in the dataBean shopWorkOrder. Can't I reference shopWorkOrder.engineerId inside the %= %? I want to compare value of userId in the collection with shopWorkOrder.engineerId. -Original Message- From: Gopalakrishnan, Jayesh [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: RE: html:select question Try something like this, bean:define id=uList name=UserFormBean property=userList/ bean;define id=person name=person.id / html:select property=person.id value=%=person% html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select The value attribute is RT-Exp, and not name of a bean. hth -jayash -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 3:38 PM To: '[EMAIL PROTECTED]' Subject: html:select question Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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: html:select question
I tried the following and got the same result. Is this what you mean? If I remove the value= then I don't get the compilation error. bean:define id=eList name=ShopWorkOrderFormBean property=engineerList/ bean:define id=engineer name=ShopWorkOrderFormBean property=shopWorkOrder.engineerId/ html:select property=shopWorkOrder.engineerId value=%=engineer% html:options collection=eList name=ShopWorkOrderFormBean property=userId labelproperty=commonName/ /html:select cannot resolve symbol probably occurred due to an error in /app/fdd/shopWorkOrder/CreateShopWorkOrder.jsp line 93: html:select property=shopWorkOrder.engineerId value=%=engineer% symbol : method setValue (java.lang.Object) location: class org.apache.struts.taglib.html.SelectTag _html_select0.setValue(engineer); -Original Message- From: Gopalakrishnan, Jayesh [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 8:44 PM To: Struts Users Mailing List Subject: RE: html:select question engineerId is an attribute in the dataBean shopWorkOrder. Can't I reference shopWorkOrder.engineerId inside the %= %? I guess shopWorkOrder is the attribute name of the bean. The %= % should contain a java expression. Use the bean:define to define a JSP variable and use it in %= % bean:define id=engineerId name=shopWorkOrder property=engineerId / then use %=engineerId% in the html:select. -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 4:49 PM To: 'Struts Users Mailing List' Subject: RE: html:select question I got a compilation errror after I changed to using %= %: Here's my error: cannot resolve symbol probably occurred due to an error in /app/fdd/shopWorkOrder/CreateShopWorkOrder.jsp line 92: html:select property=shopWorkOrder.engineerId value=%=shopWorkOrder.engineerId% My actual segment of JSP: bean:define id=eList name=ShopWorkOrderFormBean property=engineerList/ html:select property=shopWorkOrder.engineerId value=%=shopWorkOrder.engineerId% html:options collection=eList name=ShopWorkOrderFormBean property=userId labelproperty=commonName/ /html:select engineerId is an attribute in the dataBean shopWorkOrder. Can't I reference shopWorkOrder.engineerId inside the %= %? I want to compare value of userId in the collection with shopWorkOrder.engineerId. -Original Message- From: Gopalakrishnan, Jayesh [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: RE: html:select question Try something like this, bean:define id=uList name=UserFormBean property=userList/ bean;define id=person name=person.id / html:select property=person.id value=%=person% html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select The value attribute is RT-Exp, and not name of a bean. hth -jayash -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 3:38 PM To: '[EMAIL PROTECTED]' Subject: html:select question Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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: html:select question
Paul wrote: html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select No I don't know how to try yours because I don't see how the above statement tells it to compare userId with person.id and then store the value into person.id. In other words, I don't know how to convert my statement below to yours: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select -Original Message- From: Paul Stanton [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: Re: html:select question i think you are trying to do the following... html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select this is assuming uList is a list of beans with id/name fields and your form has a userId field. Au-Yeung, Stella H wrote: Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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:select question
the html:options tag handles this. Au-Yeung, Stella H wrote: Paul wrote: html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select No I don't know how to try yours because I don't see how the above statement tells it to compare userId with person.id and then store the value into person.id. In other words, I don't know how to convert my statement below to yours: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select -Original Message- From: Paul Stanton [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: Re: html:select question i think you are trying to do the following... html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select this is assuming uList is a list of beans with id/name fields and your form has a userId field. Au-Yeung, Stella H wrote: Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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: html:select question
the most simplest solution is often the best Au-Yeung, Stella H wrote: Paul wrote: html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select No I don't know how to try yours because I don't see how the above statement tells it to compare userId with person.id and then store the value into person.id. In other words, I don't know how to convert my statement below to yours: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select -Original Message- From: Paul Stanton [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: Re: html:select question i think you are trying to do the following... html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select this is assuming uList is a list of beans with id/name fields and your form has a userId field. Au-Yeung, Stella H wrote: Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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: html:select question
I see. I'll try that tomorrow and let you know. Thx. -Original Message- From: Paul Stanton [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 09, 2004 12:05 AM To: Struts Users Mailing List Subject: Re: html:select question the most simplest solution is often the best Au-Yeung, Stella H wrote: Paul wrote: html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select No I don't know how to try yours because I don't see how the above statement tells it to compare userId with person.id and then store the value into person.id. In other words, I don't know how to convert my statement below to yours: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select -Original Message- From: Paul Stanton [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 6:45 PM To: Struts Users Mailing List Subject: Re: html:select question i think you are trying to do the following... html:select name=UserFormBean property=userId html:options collection=uList property=id labelProperty=name/ /html:select this is assuming uList is a list of beans with id/name fields and your form has a userId field. Au-Yeung, Stella H wrote: Hi: I need to set a pre-defined option in html:select using the value= attribute, I thought the following will work: bean:define id=uList name=UserFormBean property=userList/ html:select property=person.id value=person.id html:options collection=uList name=UserFormBean property=userId labelproperty=commonName//html:select I have a person bean. I want to set the selected option if person.id matches userId . I thought the value attribute is to be compared with for marking an option selected. But the above doesn't work. It always set the 1st option to be the selected option . Am I misunderstanding the use of value=? - 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]
html:select question
Howdy folks, I am having some problems and hope somebody can help. Using struts-example as a starting point, I would like to move the following decalration out of the jsp page and into the ActionBean(for the sake of this example, we add it there): java.util.ArrayList list = new java.util.ArrayList(); list.add(new example.LabelValueBean(one, 1)); list.add(new example.LabelValueBean(two, 2)); list.add(new example.LabelValueBean(three, 3)); list.add(new example.LabelValueBean(four, 4)); so in my FormBean and DataBean I added the setter and getter methods to accomodate the above declaration eg: private ArrayList list = null; private String select = one; public void ArrayList getList(){ return list; } public void setList(ArrayList list){ this.list=list; } public void String getSelect(){ return select; } public void setSelect(String select){ this.select=select; } and added the list to the DataBean(which is used to populate the FormBean) in the ActionBean: ... data.setList(list); ... now for the problem, how should i define the html:select and html:options tags to get it to display the ArrayList instantiated in the ActionBean? html:select property=select html:options collection=list property=value labelProperty=label/ /html:select but this does not work. Any help will be greatly appreciated. Thanks William -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: html:select question
Figured it out, I needed to add: session.setAttribute(list, list); To my ActionBean Cheers William William Miles wrote: Howdy folks, I am having some problems and hope somebody can help. Using struts-example as a starting point, I would like to move the following decalration out of the jsp page and into the ActionBean(for the sake of this example, we add it there): java.util.ArrayList list = new java.util.ArrayList(); list.add(new example.LabelValueBean(one, 1)); list.add(new example.LabelValueBean(two, 2)); list.add(new example.LabelValueBean(three, 3)); list.add(new example.LabelValueBean(four, 4)); so in my FormBean and DataBean I added the setter and getter methods to accomodate the above declaration eg: private ArrayList list = null; private String select = one; public void ArrayList getList(){ return list; } public void setList(ArrayList list){ this.list=list; } public void String getSelect(){ return select; } public void setSelect(String select){ this.select=select; } and added the list to the DataBean(which is used to populate the FormBean) in the ActionBean: ... data.setList(list); ... now for the problem, how should i define the html:select and html:options tags to get it to display the ArrayList instantiated in the ActionBean? html:select property=select html:options collection=list property=value labelProperty=label/ /html:select but this does not work. Any help will be greatly appreciated. Thanks William -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
html:select question
Hello, i use a selectbox... the variables sb_lx and sb_l are inside the formbean. With the attached jsp-code i need to put the object sb_l from formbean into context request.setAttribute(sb_l, myform.getSb_l()); html:select property=sb_lx multiple=false size=6 html:options collection=sb_l property=id labelProperty=value/ /html:select So it works fine... but is there a way to do it without the setAttribute? Tnx, Andreas -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: html:select question
Struts-el is a good solution for this. html-el:options collection=${formean.sb_l} property=id labelProperty=value/ /html:select -Original Message- From: Andreas Langmann [mailto:andreas.langmann;isb-ag.de] Sent: Monday, November 11, 2002 4:15 AM To: 'Struts Users Mailing List' Subject: html:select question Hello, i use a selectbox... the variables sb_lx and sb_l are inside the formbean. With the attached jsp-code i need to put the object sb_l from formbean into context request.setAttribute(sb_l, myform.getSb_l()); html:select property=sb_lx multiple=false size=6 html:options collection=sb_l property=id labelProperty=value/ /html:select So it works fine... but is there a way to do it without the setAttribute? Tnx, Andreas -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: html:select question
Struts-el is a good solution for this. html-el:options collection=${formean.sb_l} property=id labelProperty=value/ /html:select Hmm... thats great! Thanks for advice! Andreas -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: html:select question
Sri, I solved my problem by doing a workaround. nothing great, but it would have been great if i didn't need to. Thanks for the input! Kael -Original Message- From: Sri Sankaran [mailto:[EMAIL PROTECTED]] Sent: Friday, August 23, 2002 3:28 PM To: Struts Users Mailing List Subject: RE: html:select question Are you sure it doesn't work? I have had Struts implicitly convert booleans to String. If it doesn't work you could always set up a dummy getter: public String getFoo() { return + room.CDRRomUseID; } and use 'foo' as your property value. Sri -Original Message- From: Teh, Kah Loong [mailto:[EMAIL PROTECTED]] Sent: Friday, August 23, 2002 4:15 PM To: Struts Users Mailing List Subject: RE: html:select question Sri, Thanks for your suggestion. Sorry i should have provided more details in my original question with the same following code : html:select property=room.CDRRoomUseID value=%=Room_Obj.getCDRRoomUseID_desc() % html:options collection=CDRRoomUseList property=CDRRoomUseID labelProperty=CDRRoomUse / /html:select var types : room.CDRRoomUseID - int value = String the options block is essentially recording CDRRoomUseIDs (of type int) to be saved to room.CDRRoomUseID, the display however, would be strings (labelProperty = CDRRoomUse) therefore your suggestion would not take hold. Do you have any more suggestions? help much appreciated. Kael -Original Message- From: Sri Sankaran [mailto:[EMAIL PROTECTED]] Sent: Friday, August 23, 2002 12:01 PM To: Struts Users Mailing List Subject: RE: html:select question You don't need the value attribute. All you have to do is set the property attribute of the html:select (room.CDRRoomUseID) to the value you want displayed by default. For example, if room.CDRRoomUseID is set to 'foo' and 'foo' is one of the value in the collection CDRRoomUseList, it will show selected when the page loads. Sri -Original Message- From: Teh, Kah Loong [mailto:[EMAIL PROTECTED]] Sent: Friday, August 23, 2002 12:50 PM To: [EMAIL PROTECTED] Subject: html:select question I'm trying to create a drop down Combo Box that allows a user to select a choice out of many from a given list. This would sort of be like an update process for an existing database entry. I would like to display the original data as the default entry for the combo box. According to the API, this can be done by setting the 'value' attribute for html:select, i have tried doing so but was not successful. The default value that is displayed on the combo box happens to be the first value returned from the List, i.e. CDRRoomUseList I have written the following code segment : // bean declarations jsp:useBean id=CDRRoomUseListclass=java.util.List scope=request / // for generating the drop down combo box html:select property=room.CDRRoomUseID value=%= Room_Obj.getCDRRoomUseID_desc() % html:options collection=CDRRoomUseList property=CDRRoomUseID labelProperty=CDRRoomUse / /html:select I have even tried doing : html:select property=room.CDR... value=test but this did not work as well. Can anybody point me towards the right direction? Thanks for any help in advance. Kael Facilities Planning University of Wisconsin - Eau Claire -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Html:select question
In the struts example struts-select.jsp there is this code: html:select property=singleSelect size=10 html:option value=Single 0Single 0/html:option html:option value=Single 1Single 1/html:option ... html:option value=Single 9Single 9/html:option /html:select When I try this code: html:select property=status size=2 html:option value=enabledEnabled/html:option html:option value=disabledDisabled/html:option /html:select I get: 500 Internal Server Error javax.servlet.jsp.JspException: No getter method available for property status for bean under name org.apache.struts.taglib.html.BEAN at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:304) at /input.jsp._jspService(/input.jsp.java:322) (JSP page line 98) at com.orionserver[Orion/1.5.2 (build 10460)].http.OrionHttpJspPage.service(Unknown Source) Why? I want status to be the name of the request parameter that is sent back. Why does Struts think this is a bean property? Should I use something other than property? TIA, Erich Kilmer Bell+Howell RTP, NC
Re: Html:select question
I haven't actually used the html:select tag, but it looks as though is expects to retrieve data from a bean. The name attribute specifies which bean to use (in the pageContext) and the property attribute specifies which property of the bean to use. HTH, Pete Kilmer, Erich wrote: In the struts example struts-select.jsp there is this code: html:select property=singleSelect size=10 html:option value=Single 0Single 0/html:option html:option value=Single 1Single 1/html:option ... html:option value=Single 9Single 9/html:option /html:select When I try this code: html:select property=status size=2 html:option value=enabledEnabled/html:option html:option value=disabledDisabled/html:option /html:select I get: 500 Internal Server Error javax.servlet.jsp.JspException: No getter method available for property status for bean under name org.apache.struts.taglib.html.BEAN at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:304) at /input.jsp._jspService(/input.jsp.java:322) (JSP page line 98) at com.orionserver[Orion/1.5.2 (build 10460)].http.OrionHttpJspPage.service(Unknown Source) Why? I want status to be the name of the request parameter that is sent back. Why does Struts think this is a bean property? Should I use something other than property? TIA, Erich Kilmer Bell+Howell RTP, NC
RE: Html:select question
In html:text the property field is the name part of the name=value in the query string. In other word its the name in the request parameter. In the struts-select.jsp there are two examples. One sets up a select with a list (called multipleValues). I can see how it works. The other, single select has all of the text in the html:option. Is there a bean called singleSelect stuck in the request or session? TIA, Erich -Original Message- From: Peter Alfors [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 3:16 PM To: [EMAIL PROTECTED] Subject: Re: Html:select question I haven't actually used the html:select tag, but it looks as though is expects to retrieve data from a bean. The name attribute specifies which bean to use (in the pageContext) and the property attribute specifies which property of the bean to use. HTH, Pete Kilmer, Erich wrote: In the struts example struts-select.jsp there is this code: html:select property=singleSelect size=10 html:option value=Single 0Single 0/html:option html:option value=Single 1Single 1/html:option ... html:option value=Single 9Single 9/html:option /html:select When I try this code: html:select property=status size=2 html:option value=enabledEnabled/html:option html:option value=disabledDisabled/html:option /html:select I get: 500 Internal Server Error javax.servlet.jsp.JspException: No getter method available for property status for bean under name org.apache.struts.taglib.html.BEAN at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:304) at /input.jsp._jspService(/input.jsp.java:322) (JSP page line 98) at com.orionserver[Orion/1.5.2 (build 10460)].http.OrionHttpJspPage.service(Unknown Source) Why? I want status to be the name of the request parameter that is sent back. Why does Struts think this is a bean property? Should I use something other than property? TIA, Erich Kilmer Bell+Howell RTP, NC
Re: Html:select question
It does this because it needs to pull the value as a property from the bean in order to determine what value to make selected in the list box. If you don't want this to be pulled from the bean, then just use regular HTML tags. Trever - Original Message - From: Kilmer, Erich [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 02, 2001 1:04 PM Subject: Html:select question In the struts example struts-select.jsp there is this code: html:select property=singleSelect size=10 html:option value=Single 0Single 0/html:option html:option value=Single 1Single 1/html:option ... html:option value=Single 9Single 9/html:option /html:select When I try this code: html:select property=status size=2 html:option value=enabledEnabled/html:option html:option value=disabledDisabled/html:option /html:select I get: 500 Internal Server Error javax.servlet.jsp.JspException: No getter method available for property status for bean under name org.apache.struts.taglib.html.BEAN at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:304) at /input.jsp._jspService(/input.jsp.java:322) (JSP page line 98) at com.orionserver[Orion/1.5.2 (build 10460)].http.OrionHttpJspPage.service(Unknown Source) Why? I want status to be the name of the request parameter that is sent back. Why does Struts think this is a bean property? Should I use something other than property? TIA, Erich Kilmer Bell+Howell RTP, NC