html:select / html:options
Hi Folks! for several days I mess around with html:select and html:options. I want to access a collection with names or numbers (just java.lang.String). This collection is available in the session. For testing I generated my own collection in the jsp % java.util.Collection list = new java.util.ArrayList(); teilnehmerListe.add(name1); teilnehmerListe.add(name2); teilnehmerListe.add(name3); session.setAttribute(myList, list); % html:form action=/myAction.do html:select property=selectedItem html:options collection=myList / /html:select html:submitOK/html:submit /html:form When I run this I get an IllegalArgumentException: no name specified I found out that both select and options have an argument name so I added some dummies test1 and test2 just to have it and get (as expected) another error: no bean found by that name test1. What am I doing wrong? Can someone point me to the right direction? Thanx and Regards, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select / html:options
hi , i think u have to get the bean from session to some Collection useing session.getAttribute(mylist) then assign it to some collection.then use that collection for populating the select lokee -Original Message- From: Christian Schlaefcke [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 2:45 AM To: Struts Users Mailing List Subject: html:select / html:options Hi Folks! for several days I mess around with html:select and html:options. I want to access a collection with names or numbers (just java.lang.String). This collection is available in the session. For testing I generated my own collection in the jsp % java.util.Collection list = new java.util.ArrayList(); teilnehmerListe.add(name1); teilnehmerListe.add(name2); teilnehmerListe.add(name3); session.setAttribute(myList, list); % html:form action=/myAction.do html:select property=selectedItem html:options collection=myList / /html:select html:submitOK/html:submit /html:form When I run this I get an IllegalArgumentException: no name specified I found out that both select and options have an argument name so I added some dummies test1 and test2 just to have it and get (as expected) another error: no bean found by that name test1. What am I doing wrong? Can someone point me to the right direction? Thanx and Regards, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select / html:options
Hi, I believe you need to read the following link http://www.jajakarta.org/struts/struts1.1/documentation/ja/target/userGuide/ printer/struts-html.html#options This should give you an idea of what the attributes of html:options are. Collection should be a set of java beans. Rules are clearly provided in the above link. I can give you an example using html:optionsCollection html:form action=Roles method=post table border=0 align=center width=100% tr td bean:message key=app.roleselection/ /td /tr tr td align=center html:select style=width:180px size=8 property=strRoleId html:optionsCollection property=htUserRoles label=strDisplayName value=strId/ /html:select /td /tr /table html:submit/ /html:form Regards, Sanoj Antony -Original Message- From: Christian Schlaefcke [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 4:15 PM To: Struts Users Mailing List Subject: html:select / html:options Hi Folks! for several days I mess around with html:select and html:options. I want to access a collection with names or numbers (just java.lang.String). This collection is available in the session. For testing I generated my own collection in the jsp % java.util.Collection list = new java.util.ArrayList(); teilnehmerListe.add(name1); teilnehmerListe.add(name2); teilnehmerListe.add(name3); session.setAttribute(myList, list); % html:form action=/myAction.do html:select property=selectedItem html:options collection=myList / /html:select html:submitOK/html:submit /html:form When I run this I get an IllegalArgumentException: no name specified I found out that both select and options have an argument name so I added some dummies test1 and test2 just to have it and get (as expected) another error: no bean found by that name test1. What am I doing wrong? Can someone point me to the right direction? Thanx and Regards, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select / html:options
session.setAttribute(myList, list); session.setAttribute(myList,list.toArray()); for some reason you need to cast to list to an array. On 24 Mar 2004, at 01:23, Lokanath wrote: hi , i think u have to get the bean from session to some Collection useing session.getAttribute(mylist) then assign it to some collection.then use that collection for populating the select lokee -Original Message- From: Christian Schlaefcke [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 2:45 AM To: Struts Users Mailing List Subject: html:select / html:options Hi Folks! for several days I mess around with html:select and html:options. I want to access a collection with names or numbers (just java.lang.String). This collection is available in the session. For testing I generated my own collection in the jsp % java.util.Collection list = new java.util.ArrayList(); teilnehmerListe.add(name1); teilnehmerListe.add(name2); teilnehmerListe.add(name3); session.setAttribute(myList, list); % html:form action=/myAction.do html:select property=selectedItem html:options collection=myList / /html:select html:submitOK/html:submit /html:form When I run this I get an IllegalArgumentException: no name specified I found out that both select and options have an argument name so I added some dummies test1 and test2 just to have it and get (as expected) another error: no bean found by that name test1. What am I doing wrong? Can someone point me to the right direction? Thanx and Regards, Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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.
RE: html:select
Paul: I tried the following in the JSP based on your suggestion and it is still not defaulting to the desired option. I just want to default the option to whatever matches between shopWorkOrder.engineerId and userId. Segment of JSP: bean:define id=eList name=ShopWorkOrderFormBean property=engineerList/ html:select property=shopWorkOrder.engineerId html:options collection=eList name=ShopWorkOrderFormBean property=userId labelproperty=commonName/ /html:select The following debug section is used to print out if shopWorkOrder.engineerId matches any userId in the ArrayList: String engineer = formBean.getShopWorkOrder().getEngineerId(); PeopleBean pBean; EtLog.debug(this,EngineerId=+engineer+***); for (int i=0; iformBean.getEngineerList().size(); i++) { pBean = (PeopleBean) formBean.getEngineerList().get(i); if (engineer != null engineer.equals(pBean.getUserId())) { EtLog.debug(this,Found Matching ID= + pBean.getUserId() + ***); break; } } And the debug printout suggested it found a matching id. But the html:select and html:option won't default to it: 03/09/2004 10:54:28 [DBUG] ShopWorkOrderMaintainAction EngineerId=8*** 03/09/2004 10:54:28 [DBUG] ShopWorkOrderMaintainAction Found Matching ID=8*** Did I misunderstand what you suggested? -Original Message- From: Paul Stanton [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 09, 2004 12:45 AM To: Au-Yeung, Stella H Subject: html:select this is by far the simplest way to achieve what you desire, but it does assume that your form is already populated with data. if your form is populated, the populated values will be used to select the correct option in the select. if it isn't (or the field is null) no option will be selected. i like to set my defaults to the fields values on the form bean in reset() and at field initialisation. html:select property=formBeanProp html:options collection=collection property=listProp labelProperty=listLabel / /html:select formBeanProp: the name of the field on the form bean of the enclosing html:form tag. if this field has a value matching one of the listProp values, this item will be selected. collection: the name of the attribute you have stored the list you are using to populate the options under. listProp: the name of the field in the list elements that will be used to compare to the formBeanProp. listLabel: the name of the field in the list elements that will be displayed to the user. note: if your value/label for your options is going to be the same you can omit this. hope this helps. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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]
how to set selectedIndex at html:select
How can change the selectedIndex of dropdown values obrigado Daniel S.
Re: how to set selectedIndex at html:select
set the value of the form property that you wish to select. On 27 Feb 2004, at 17:40, Daniel wrote: How can change the selectedIndex of dropdown values obrigado Daniel S. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Return an object using html:select
Is it possible to set an object in an action form to an object from a list using an html:select? My code is: struts-config: form-bean name=activityForm type=org.apache.struts.validator.DynaValidatorForm form-property name=activityType type=ActivityType/ form-property name=activityTypes type=java.util.ArrayList/ /form-bean ActivityType bean: public class ActivityType { private long id; private String name; public String getName(){ return name; } public void setName(String name){ this.name = name; } public long getId(){ return id; } public void setId(long id){ this.id = id; } } jsp snippet: html:select name=activityForm property=activityType html:optionsCollection name=activityForm property=activityTypes value=id label=name/ /html:select This obviously doesn't work, because I am trying to assign a long to an object. Is there another way to do this? Has it been discussed before? TIA Russell --- This email message and any attachment(s) is intended only for the person(s) or entity(entities) to whom it is addressed. The information it contains may be classified as IN CONFIDENCE and may be legally privileged. If you are not the intended recipient any use, disclosure or copying of the message or attachment(s) is strictly prohibited. If you have received this message in error please notify us immediately and destroy it and any attachment(s). Thank you. The Ministry of Social Development accepts no responsibility for changes made to this message or to any attachment(s) after transmission from the Ministry. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:select
Hello . I have to get the description from a html:select example in html select name =xx option value=zz/option /select how can I do to get the z value ??? ( using struts ) thamks .. serge Aquest missatge electronic pot contenir informacio confidencial o privilegiada. Si voste no es el destinatari del missatge, o l'ha rebut per error, si us plau notifiqui-ho al remitent i destrueixi el missatge amb tot el seu contingut. Esta completament prohibida qualsevol copia, us o distribucio no autoritzada del contingut d'aquest missatge electronic. Este mensaje electronico puede contener informacion confidencial o privilegiada. Si usted no es el destinatario de este mensaje o lo ha recibido por error, por favor notifiquelo al remitente y destruya el mensaje con todo su contenido. Queda expresamente prohibida cualquier copia, utilizacion o distribucion no autorizada del contenido de este mensaje electronico. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select
From: Gonzalez, Sergio Eduardo [mailto:[EMAIL PROTECTED] I have to get the description from a html:select example in html select name =xx option value=zz/option /select how can I do to get the z value ??? ( using struts ) Make the tag look like this instead: select name =xx option value=zz/option /select It's the 'value' that will get sent to the server, not the displayed text. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select
form.xx.options[form.xx.selectedIndex].text; On 2004-Feb-17 17:02, Gonzalez, Sergio Eduardo wrote: Hello . I have to get the description from a html:select example in html select name =xx option value=zz/option /select how can I do to get the z value ??? ( using struts ) -- Nick Heudecker System Mobile, Inc. Email: [EMAIL PROTECTED] Web: http://www.systemmobile.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RV: html:select
Ok . How can I do to send the value displayed ? -Mensaje original- De: Wendy Smoak [mailto:[EMAIL PROTECTED] Enviado el: martes, 17 de febrero de 2004 17:25 Para: Struts Users Mailing List Asunto: RE: html:select From: Gonzalez, Sergio Eduardo [mailto:[EMAIL PROTECTED] I have to get the description from a html:select example in html select name =xx option value=zz/option /select how can I do to get the z value ??? ( using struts ) Make the tag look like this instead: select name =xx option value=zz/option /select It's the 'value' that will get sent to the server, not the displayed text. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Aquest missatge electronic pot contenir informacio confidencial o privilegiada. Si voste no es el destinatari del missatge, o l'ha rebut per error, si us plau notifiqui-ho al remitent i destrueixi el missatge amb tot el seu contingut. Esta completament prohibida qualsevol copia, us o distribucio no autoritzada del contingut d'aquest missatge electronic. Este mensaje electronico puede contener informacion confidencial o privilegiada. Si usted no es el destinatario de este mensaje o lo ha recibido por error, por favor notifiquelo al remitente y destruya el mensaje con todo su contenido. Queda expresamente prohibida cualquier copia, utilizacion o distribucion no autorizada del contenido de este mensaje electronico. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select
From: Gonzalez, Sergio Eduardo [mailto:[EMAIL PROTECTED] How can I do to send the value displayed ? Can you post the code from the JSP the way it is now? Someone can probably help you change it so that it does what you want. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select
I need to send the value and text dispayed to the server -Mensaje original- De: Wendy Smoak [mailto:[EMAIL PROTECTED] Enviado el: martes, 17 de febrero de 2004 17:39 Para: Struts Users Mailing List Asunto: RE: html:select From: Gonzalez, Sergio Eduardo [mailto:[EMAIL PROTECTED] How can I do to send the value displayed ? Can you post the code from the JSP the way it is now? Someone can probably help you change it so that it does what you want. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Aquest missatge electronic pot contenir informacio confidencial o privilegiada. Si voste no es el destinatari del missatge, o l'ha rebut per error, si us plau notifiqui-ho al remitent i destrueixi el missatge amb tot el seu contingut. Esta completament prohibida qualsevol copia, us o distribucio no autoritzada del contingut d'aquest missatge electronic. Este mensaje electronico puede contener informacion confidencial o privilegiada. Si usted no es el destinatario de este mensaje o lo ha recibido por error, por favor notifiquelo al remitente y destruya el mensaje con todo su contenido. Queda expresamente prohibida cualquier copia, utilizacion o distribucion no autorizada del contenido de este mensaje electronico. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select
Well, I guess that's what Wendy was suggesting in the first place: make the value and the text the same, that way sending one is tatamount to sending both.. The other option is to use a hidden field and javascript (onSelect fill hidden field kind of thing along with the form.blah-blah[selectedIndex].value that another person suggested earlier..) Geeta Gonzalez, Sergio Eduardo wrote: I need to send the value and text dispayed to the server - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select
Surely your application is responsible for creating the options in the first place? Why not create a map of the key,value pairs at that time refer to it later? Paul -Original Message- From: Gonzalez, Sergio Eduardo [mailto:[EMAIL PROTECTED] Sent: 17 February 2004 16:13 To: Struts Users Mailing List Subject: html:select Hello . I have to get the description from a html:select example in html select name =xx option value=zz/option /select how can I do to get the z value ??? ( using struts ) thamks .. serge -- -- Aquest missatge electronic pot contenir informacio confidencial o privilegiada. Si voste no es el destinatari del missatge, o l'ha rebut per error, si us plau notifiqui-ho al remitent i destrueixi el missatge amb tot el seu contingut. Esta completament prohibida qualsevol copia, us o distribucio no autoritzada del contingut d'aquest missatge electronic. -- -- Este mensaje electronico puede contener informacion confidencial o privilegiada. Si usted no es el destinatario de este mensaje o lo ha recibido por error, por favor notifiquelo al remitente y destruya el mensaje con todo su contenido. Queda expresamente prohibida cualquier copia, utilizacion o distribucion no autorizada del contenido de este mensaje electronico. -- -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. -- -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select
Yeah, what I do is just use a LabelValueBean form property to pass the value and txt back to the server. I set the text property using the onBlur javascript event. On 2004-Feb-17 17:02, Gonzalez, Sergio Eduardo wrote: I need to send the value and text dispayed to the server -Mensaje original- De: Wendy Smoak [mailto:[EMAIL PROTECTED] Enviado el: martes, 17 de febrero de 2004 17:39 Para: Struts Users Mailing List Asunto: RE: html:select From: Gonzalez, Sergio Eduardo [mailto:[EMAIL PROTECTED] How can I do to send the value displayed ? Can you post the code from the JSP the way it is now? Someone can probably help you change it so that it does what you want. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Aquest missatge electronic pot contenir informacio confidencial o privilegiada. Si voste no es el destinatari del missatge, o l'ha rebut per error, si us plau notifiqui-ho al remitent i destrueixi el missatge amb tot el seu contingut. Esta completament prohibida qualsevol copia, us o distribucio no autoritzada del contingut d'aquest missatge electronic. Este mensaje electronico puede contener informacion confidencial o privilegiada. Si usted no es el destinatario de este mensaje o lo ha recibido por error, por favor notifiquelo al remitente y destruya el mensaje con todo su contenido. Queda expresamente prohibida cualquier copia, utilizacion o distribucion no autorizada del contenido de este mensaje electronico. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Nick Heudecker System Mobile, Inc. Email: [EMAIL PROTECTED] Phone: 734.604.9192 Web: http://www.systemmobile.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select
From: Gonzalez, Sergio Eduardo [mailto:[EMAIL PROTECTED] I need to send the value and text dispayed to the server Now I have to ask, why? Presumably you're generating the selections from something, maybe a Map? All you need is the value, they key, and you can pull the value out of the Map without having it sent from the browser. There are ways, you could use JavaScript to set a hidden form field, or just concatenate the value text: select name =xx option value=123|Some TextSome Text/option/select select and then parse it when it arrives at the server. (For the record, that's not a recommendation, just an option!) But it would help if you'd post the code from the JSP that you're using. Right now I don't know if you're using html:select or if you're 'manually' writing out the select tags. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using a java.util.List with a HTML:SELECT
is it possible to use a java.util.List object with an HTML:SELECT control. import java.util.List; import java.util.ArrayList; public final class Roles extends Ojbect { public Roles() {} public static List getRoles() { List r = new ArrayList(); r.add(ADMIN); r.add(SUPERADMIN); r.add(CLERK); r.add(SUPERCLERK); return r; } } in jsp i would use html:form action=. html:select property=formprop !-- what goest inside the html:select aattribute -- html:options.. html:select /html:form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using a java.util.List with a HTML:SELECT
Hi, You can try something like this: 1. Instead of return r --- request.setAttribute(formprop,r); 2. In your JSP select name=formprop logic:iterate id=field name=formprop option value=bean:write name=field property=formprop[]/bean:write name=field property=formprop[]//option /logic:iterate /select If you want your property|value pair to be different, you should use a HashMap. Oliver is it possible to use a java.util.List object with an HTML:SELECT control. import java.util.List; import java.util.ArrayList; public final class Roles extends Ojbect { public Roles() {} public static List getRoles() { List r = new ArrayList(); r.add(ADMIN); r.add(SUPERADMIN); r.add(CLERK); r.add(SUPERCLERK); return r; } } in jsp i would use html:form action=. html:select property=formprop !-- what goest inside the html:select aattribute -- html:options.. html:select /html:form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...) jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using a java.util.List with a HTML:SELECT
The html:options and html:optionsCollection... tags expect a collection of beans - not String values. If you put the values in beans then you it goes something like html:select name=myForm property=roleName html:optionsCollection name=myForm property=roleList label=roleName value=roleId/ /html:select So you store the list of roles in your action form under the property roleList and that contains a List of beans which have roleName and roleId properties. Niall - Original Message - From: sean jones [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 13, 2004 5:00 PM Subject: Using a java.util.List with a HTML:SELECT is it possible to use a java.util.List object with an HTML:SELECT control. import java.util.List; import java.util.ArrayList; public final class Roles extends Ojbect { public Roles() {} public static List getRoles() { List r = new ArrayList(); r.add(ADMIN); r.add(SUPERADMIN); r.add(CLERK); r.add(SUPERCLERK); return r; } } in jsp i would use html:form action=. html:select property=formprop !-- what goest inside the html:select aattribute -- html:options.. html:select /html:form - 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: Using a java.util.List with a HTML:SELECT
i am aware of this option but DAO only returns a list of Strings and i prefer that to a list of beans. The reason is i am more interested in the role name than the role_id. I plan to delete all the roles then put them back with a batchupdate. This allows the user to selected all the roles to get rid of in one shot -vs- one at a time. Also roles cannot be deleted if they are in use (USER_ROLES - {user_id, role_id}) Maybe i am wrong, and should change the DAO to return a List of LabelValueBeans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:select with multiple selections
Hi, I have a html:select tag with multiple selections. Fist I select two elements. After this I deselect this elements, but If I come back to this site, the two elements will be selected again. I don't know why. I think the property for the select box is not set by populating the form, so it are the old values. I use session as sope. Has anyone an idea? Regards, Frank
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: select name=ref option value=1scanner/option option value=2harddisk/option /select Has anyone an idea? Regards, Frank
Re: html:options and html:select
you can do the following: html:select name=FormName property=xxx logic:iterate id=product name=FormName property=ListName option value=bean:write name=product property=id/bean:write name=product property=name/ /logic:iterate /html:select '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 logic:iterate tag. For every object in your list an option 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: select name=ref option value=1scanner/option option value=2harddisk/option /select 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
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()); ... html:option value=--/html:option html:options collection=products property=id labelProperty=name / 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 c:import url=/product/list.do / 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: select name=ref option value=1scanner/option option value=2harddisk/option /select Has anyone an idea? Regards, Frank - 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. html:select property=ref html:optionsCollections name=myForm property=myListOfBean value=id label=name/ /html:select 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: html:select name=FormName property=xxx logic:iterate id=product name=FormName property=ListName option value=bean:write name=product property=id/bean:write name=product property=name/ /logic:iterate /html:select '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 logic:iterate tag. For every object in your list an option 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: select name=ref option value=1scanner/option option value=2harddisk/option /select 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
Hi Frank Try using Request.setAttribute(collectionName,list); html:select name=formBeanName property=seletedValue html:options collection=collectionName value=id labelProperty=name name=comCProduct/ /html:select 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: select name=ref option value=1scanner/option option value=2harddisk/option /select 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]
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. html:select property=ref html:optionsCollections name=myForm property=myListOfBean value=id label=name/ /html:select 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: html:select name=FormName property=xxx logic:iterate id=product name=FormName property=ListName option value=bean:write name=product property=id/bean:write name=product property=name/ /logic:iterate /html:select '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 logic:iterate tag. For every object in your list an option 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: select name=ref option value=1scanner/option option value=2harddisk/option /select 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: 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. html:select property=ref html:optionsCollections name=myForm property=myListOfBean value=id label=name/ /html:select 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: html:select name=FormName property=xxx logic:iterate id=product name=FormName property=ListName option value=bean:write name=product property=id/bean:write name=product property=name/ /logic:iterate /html:select '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 logic:iterate tag. For every object in your list an option 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: select name=ref option value=1scanner/option option value=2harddisk/option /select 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: 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. html:select property=ref html:optionsCollections name=myForm property=myListOfBean value=id label=name/ /html:select 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: html:select name=FormName property=xxx logic:iterate id=product name=FormName property=ListName option value=bean:write name=product property=id/bean:write name=product property=name/ /logic:iterate /html:select '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 logic:iterate tag. For every object in your list an option 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: select name=ref option value=1scanner/option option value=2harddisk/option /select 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: 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 html:select name=formBeanName property=seletedValue html:options collection=collectionName value=value labelProperty=label / /html:select Jiin-Her Lu (816) 926-2145 [EMAIL PROTECTED] 02/02/04 06:31AM Hi Frank Try using Request.setAttribute(collectionName,list); html:select name=formBeanName property=seletedValue html:options collection=collectionName value=id labelProperty=name name=comCProduct/ /html:select 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: select name=ref option value=1scanner/option option value=2harddisk/option /select 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]
html:select multiple=true question
Hi. I have a bean stored in page scope with id active. It returns a String[] on getIds() and getLabels(). I use the following to render a multiple select box: html:select size=10 name=active multiple=true property=ids html:options name=active property=ids labelName=active labelProperty=labels/ /html:select What's wrong with this approach? I wish to have all elements selected. All elements show and have the proper value/label, but they do not get selected. Can anyone please tell me how the property attribute of the select tag determines what options get set as selected? Thanks. Br, Morten - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select multiple=true question
I used the same property name for select and Options tag..it worked in a dynaaction form. Thank-you, Manoj Mathew GIS 515-362-0539 -Original Message- From: Morten [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 6:00 AM To: [EMAIL PROTECTED] Subject: html:select multiple=true question Hi. I have a bean stored in page scope with id active. It returns a String[] on getIds() and getLabels(). I use the following to render a multiple select box: html:select size=10 name=active multiple=true property=ids html:options name=active property=ids labelName=active labelProperty=labels/ /html:select What's wrong with this approach? I wish to have all elements selected. All elements show and have the proper value/label, but they do not get selected. Can anyone please tell me how the property attribute of the select tag determines what options get set as selected? Thanks. Br, Morten - 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 example
Would someone show me a very simple example of the use of an html:select tag? I did not understand its use. I'd appreciate any simple example. Thanks a lot. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select example
Would someone show me a very simple example of the use of an html:select tag? I did not understand its use. I'd appreciate any simple example. html:select property=someProperty html:option value= / html:optionsCollection property=someCollection / /html:select The select tag can contain a list of option tags, or an options or optionsCollection tag or any combination. Here I use 1 option tag to provide a blank default and a optionsCollection tag with a collection of LabelValueBean objects to provide the rest of the list (the fact that the collection contains LabelValueBean objects makes the syntax much simplier as you don't have to specify the label or value properties. The value that matches the value of someProperty will automatically be selected. - Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select example
I have some examples of Struts tags, including html:select, at http://www.ninsky.com/struts Various other examples are listed at http://struts.sourceforge.net/community/examples.html Steve Sorry if this is a duplicate message, sent the first one from the wrong address :-( -Original Message- From: Otavio Augusto [mailto:[EMAIL PROTECTED] Sent: December 30, 2003 8:41 AM To: [EMAIL PROTECTED] Subject: html:select example Would someone show me a very simple example of the use of an html:select tag? I did not understand its use. I'd appreciate any simple example. Thanks a lot. - 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 example
some working examples, but I'm not expert ;-) html:select property=previewFontStyle styleClass=inputfield html:option value=0normal/html:option html:option value=1gras/html:option html:option value=2italique/html:option html:option value=3gras-italique/html:option /html:select html:select property=previewFontSize styleClass=inputfield c:forEach items=${partner.commonSize} var=item html-el:option value=${item}c:out value=${item}//html-el:option /c:forEach /html:select For the second one, It seems that there is other way to do the same, using html:options or html:optioncollection, but I've never used it. Good luck Carl Otávio Augusto wrote: Would someone show me a very simple example of the use of an html:select tag? I did not understand its use. I'd appreciate any simple example. Thanks a lot. - 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 default value problem
Hi, I know this has been talked about before, and I'm pretty sure I understand the concept, but I don't know why this is not working. The default option for an html:select is not being displayed. I have an ActionForm in request scope called BusinessForm that is populated. The status property has a value of 1 as verified by sticking in a bean:write, but the select list shows the value=0 option as the default item when I load the page. I have twelve other html elements on the page, and they all show the correct defaults, except for this html:select. Am I not seeing something in the code below... thanks...keith --- html:form action=action.do scope=request name=BusinessForm type=BusinessForm !-- to verify the value of the status property (it displays 1) -- bean:write name=BusinessForm property=status / html:select property=status option value=00 - INACTIVE/option option value=11 - ACTIVE/option /html:select ... /html:form - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select default value problem
Try this: html:select property=status html:option value=00 - INACTIVE/html:option html:option value=11 - ACTIVE/html:option /html:select The regular HTML option/ element doesn't communicate with Struts. You need to use html:option / robert -Original Message- From: Keith C. Klopfer [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 6:12 AM To: [EMAIL PROTECTED] Subject: html:select default value problem Hi, I know this has been talked about before, and I'm pretty sure I understand the concept, but I don't know why this is not working. The default option for an html:select is not being displayed. I have an ActionForm in request scope called BusinessForm that is populated. The status property has a value of 1 as verified by sticking in a bean:write, but the select list shows the value=0 option as the default item when I load the page. I have twelve other html elements on the page, and they all show the correct defaults, except for this html:select. Am I not seeing something in the code below... thanks...keith --- html:form action=action.do scope=request name=BusinessForm type=BusinessForm !-- to verify the value of the status property (it displays 1) -- bean:write name=BusinessForm property=status / html:select property=status option value=00 - INACTIVE/option option value=11 - ACTIVE/option /html:select ... /html:form - 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 tag or logic:iterate
Hi all, I am quite new to struts tag library and I need an advice. In the HttpSession I have an object of type Collection, which stores a list of MyObject. MyOBject has two properties, description and id. Out of this Collection of MyObject I must generate a selectable list Which displays MyObject names, (wity MyObject.id as value) I have tried to embed the html:select inside a logic:iterate, but my editor (websphere studio)complaints for following code html:select property=defaultContainerType multiple=no logic:iterate collection=%= (Collection)session.getAttribute(CONTAINER_TYPES)% id=container html:option value=bean:write name=container property=type/ bean:write name=container property=description/ /html:option /logic:iterate /html:select the error is 'Attribute container has no value' anyone has a suggestion on how to solve my problem? Fact is that the Collection is stored in the session, not in a JavaBean.. Thanks and regards marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select tag or logic:iterate
try this, html:select property=defaultContainerType html:options collection=CONTAINER_TYPES property=id labelProperty=name/ /html:select F. - Original Message - From: Marco Mistroni [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Monday, December 15, 2003 3:00 PM Subject: html:select tag or logic:iterate Hi all, I am quite new to struts tag library and I need an advice. In the HttpSession I have an object of type Collection, which stores a list of MyObject. MyOBject has two properties, description and id. Out of this Collection of MyObject I must generate a selectable list Which displays MyObject names, (wity MyObject.id as value) I have tried to embed the html:select inside a logic:iterate, but my editor (websphere studio)complaints for following code html:select property=defaultContainerType multiple=no logic:iterate collection=%= (Collection)session.getAttribute(CONTAINER_TYPES)% id=container html:option value=bean:write name=container property=type/ bean:write name=container property=description/ /html:option /logic:iterate /html:select the error is 'Attribute container has no value' anyone has a suggestion on how to solve my problem? Fact is that the Collection is stored in the session, not in a JavaBean.. Thanks and regards marco - 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]
RES: html:select tag or logic:iterate
Inside the struts-exercise-taglib.war that comes with struts 1.1 you will find a pratical example to solve your problem... You should not do a logic:iterate inside html:select, insteat of logic:iterate use the option:optionsCollection and pass your collection to it... look the jsp example Vector options = new Vector(); options.add(new LabelValueBean(Label 0, Value 0)); options.add(new LabelValueBean(Label 1, Value 1)); options.add(new LabelValueBean(Label 2, Value 2)); options.add(new LabelValueBean(Label 3, Value 3)); options.add(new LabelValueBean(Label 4, Value 4)); options.add(new LabelValueBean(Label 5, Value 5)); options.add(new LabelValueBean(Label 6, Value 6)); options.add(new LabelValueBean(Label 7, Value 7)); options.add(new LabelValueBean(Label 8, Value 8)); options.add(new LabelValueBean(Label 9, Value 9)); pageContext.setAttribute(options, options); html:select property=collectionSelect size=10 multiple=true html:options collection=options property=value labelProperty=label/ /html:select or jsp:useBean id=testbean scope=session class=org.apache.struts.webapp.exercise.TestBean/ html:select property=beanCollectionSelect size=10 multiple=true html:optionsCollection name=testbean property=beanCollection/ /html:select Tiago Henrique C. R. Alves -Mensagem original- De: Marco Mistroni [mailto:[EMAIL PROTECTED] Enviada em: segunda-feira, 15 de dezembro de 2003 10:00 Para: 'Struts Users Mailing List' Assunto: html:select tag or logic:iterate Hi all, I am quite new to struts tag library and I need an advice. In the HttpSession I have an object of type Collection, which stores a list of MyObject. MyOBject has two properties, description and id. Out of this Collection of MyObject I must generate a selectable list Which displays MyObject names, (wity MyObject.id as value) I have tried to embed the html:select inside a logic:iterate, but my editor (websphere studio)complaints for following code html:select property=defaultContainerType multiple=no logic:iterate collection=%= (Collection)session.getAttribute(CONTAINER_TYPES)% id=container html:option value=bean:write name=container property=type/ bean:write name=container property=description/ /html:option /logic:iterate /html:select the error is 'Attribute container has no value' anyone has a suggestion on how to solve my problem? Fact is that the Collection is stored in the session, not in a JavaBean.. Thanks and regards marco - 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: Problem with html:select tag calling set method in form
Is this the correct functionallity of struts?? if you have a multiple selection list box, and everything is deselected, the setter method in the form object is not getting called. It only gets called if there are 1 or more entries in the list box selected ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | damian_bradicich@| | | stchome.com | | || | | 10/30/2003 10:44 | | | AM | | | Please respond to| | | Struts Users| | | Mailing List| | || |-+ --| | | |To: Struts Users Mailing List [EMAIL PROTECTED] | |cc: | |Subject: Problem with html:select tag calling set method in form | --| I have a jsp that creates a select tag w/ size = 2 and multiple also true, which gives me a list box w/ multi selection. So, I open up the page, and I see all the data fine, I select a couple of items in the list box and save, everything is great, my setter in the form is getting called. However, if i deselect all entries in the list box, and save, the setter method in the form is not being called, has anyone else noticed this? If so, does anyone have a workaround? ___ Damian Bradicich Software Developer Scientific Technologies Corporation Web Site: www.stchome.com Advancing Public Health Core Capacities While Leveraging the Resources of a Community ___ - 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: Problem with html:select tag calling set method in form
This looke like correct to me.Because if you do not select anything, that also means that there wont be any value sent for that request parameter.And so the setter will not be called. You can runa simple check.Check by calling request.getParameter if any parameter with the name for the select box is being sent in request.I am sure you wont find any... HTH. regards, Shirish -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 3:21 PM To: Struts Users Mailing List Subject: Re: Problem with html:select tag calling set method in form Is this the correct functionallity of struts?? if you have a multiple selection list box, and everything is deselected, the setter method in the form object is not getting called. It only gets called if there are 1 or more entries in the list box selected ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | damian_bradicich@| | | stchome.com | | || | | 10/30/2003 10:44 | | | AM | | | Please respond to| | | Struts Users| | | Mailing List| | || |-+ --| | | |To: Struts Users Mailing List [EMAIL PROTECTED] | |cc: | |Subject: Problem with html:select tag calling set method in form | --| I have a jsp that creates a select tag w/ size = 2 and multiple also true, which gives me a list box w/ multi selection. So, I open up the page, and I see all the data fine, I select a couple of items in the list box and save, everything is great, my setter in the form is getting called. However, if i deselect all entries in the list box, and save, the setter method in the form is not being called, has anyone else noticed this? If so, does anyone have a workaround? ___ Damian Bradicich Software Developer Scientific Technologies Corporation Web Site: www.stchome.com Advancing Public Health Core Capacities While Leveraging the Resources of a Community ___ - 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: Problem with html:select tag calling set method in form
I was thinking that was the case, but was hoping otherwise, I'll have to come up w/ a javascript solution. thx for the help Shirish ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | shirishchandra.sakha| | | [EMAIL PROTECTED] | | || | | 11/04/2003 09:35 AM | | | Please respond to| | | Struts Users Mailing| | | List| | || |-+ --| | | |To: [EMAIL PROTECTED] | |cc: | |Subject: RE: Problem with html:select tag calling set method in form | --| This looke like correct to me.Because if you do not select anything, that also means that there wont be any value sent for that request parameter.And so the setter will not be called. You can runa simple check.Check by calling request.getParameter if any parameter with the name for the select box is being sent in request.I am sure you wont find any... HTH. regards, Shirish -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 3:21 PM To: Struts Users Mailing List Subject: Re: Problem with html:select tag calling set method in form Is this the correct functionallity of struts?? if you have a multiple selection list box, and everything is deselected, the setter method in the form object is not getting called. It only gets called if there are 1 or more entries in the list box selected ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | damian_bradicich@| | | stchome.com | | || | | 10/30/2003 10:44 | | | AM | | | Please respond to| | | Struts Users| | | Mailing List| | || |-+ --| | | |To: Struts Users Mailing List [EMAIL PROTECTED] | |cc: | |Subject: Problem with html:select tag calling set method in form | --| I have a jsp that creates a select tag w/ size = 2 and multiple also true, which gives me a list box w/ multi selection. So, I open up the page, and I see all the data fine, I select a couple of items in the list box and save, everything is great, my setter in the form is getting called. However, if i deselect all entries in the list box, and save, the setter method in the form is not being called, has anyone else noticed this? If so, does anyone have a workaround? ___ Damian Bradicich Software Developer Scientific Technologies Corporation Web Site: www.stchome.com Advancing Public Health Core Capacities While Leveraging the Resources of a Community ___ - 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
RE: Problem with html:select tag calling set method in form
what is it you are trying to do?I mean why the setter should be caled when nothing is selected? Just curious :-)) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 4:41 PM To: Struts Users Mailing List Subject: RE: Problem with html:select tag calling set method in form I was thinking that was the case, but was hoping otherwise, I'll have to come up w/ a javascript solution. thx for the help Shirish ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | shirishchandra.sakha| | | [EMAIL PROTECTED] | | || | | 11/04/2003 09:35 AM | | | Please respond to| | | Struts Users Mailing| | | List| | || |-+ --| | | |To: [EMAIL PROTECTED] | |cc: | |Subject: RE: Problem with html:select tag calling set method in form | --| This looke like correct to me.Because if you do not select anything, that also means that there wont be any value sent for that request parameter.And so the setter will not be called. You can runa simple check.Check by calling request.getParameter if any parameter with the name for the select box is being sent in request.I am sure you wont find any... HTH. regards, Shirish -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 3:21 PM To: Struts Users Mailing List Subject: Re: Problem with html:select tag calling set method in form Is this the correct functionallity of struts?? if you have a multiple selection list box, and everything is deselected, the setter method in the form object is not getting called. It only gets called if there are 1 or more entries in the list box selected ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | damian_bradicich@| | | stchome.com | | || | | 10/30/2003 10:44 | | | AM | | | Please respond to| | | Struts Users| | | Mailing List| | || |-+ --| | | |To: Struts Users Mailing List [EMAIL PROTECTED] | |cc: | |Subject: Problem with html:select tag calling set method in form | --| I have a jsp that creates a select tag w/ size = 2 and multiple also true, which gives me a list box w/ multi selection. So, I open up the page, and I see all the data fine, I select a couple of items in the list box and save, everything is great, my setter in the form is getting called. However, if i deselect all entries in the list box, and save, the setter method in the form is not being called, has anyone else noticed this? If so, does anyone have a workaround? ___ Damian Bradicich Software Developer Scientific Technologies Corporation Web Site: www.stchome.com Advancing Public Health Core Capacities While Leveraging the Resources of a Community ___ - To unsubscribe, e-mail: [EMAIL PROTECTED
RE: Problem with html:select tag calling set method in form
We have a couple of pages which use the same form (advanced and basic search), so the reset method can't be used to clear the fields (as you would for any normal pages). I was hoping that the setter would be called to reset the field, so I am putting javascript in to null out the field in the form so that the changes will be saved properly ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | shirishchandra.sakha| | | [EMAIL PROTECTED] | | || | | 11/04/2003 11:09 AM | | | Please respond to| | | Struts Users Mailing| | | List| | || |-+ --| | | |To: [EMAIL PROTECTED] | |cc: | |Subject: RE: Problem with html:select tag calling set method in form | --| what is it you are trying to do?I mean why the setter should be caled when nothing is selected? Just curious :-)) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 4:41 PM To: Struts Users Mailing List Subject: RE: Problem with html:select tag calling set method in form I was thinking that was the case, but was hoping otherwise, I'll have to come up w/ a javascript solution. thx for the help Shirish ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | shirishchandra.sakha| | | [EMAIL PROTECTED] | | || | | 11/04/2003 09:35 AM | | | Please respond to| | | Struts Users Mailing| | | List| | || |-+ --| | | |To: [EMAIL PROTECTED] | |cc: | |Subject: RE: Problem with html:select tag calling set method in form | --| This looke like correct to me.Because if you do not select anything, that also means that there wont be any value sent for that request parameter.And so the setter will not be called. You can runa simple check.Check by calling request.getParameter if any parameter with the name for the select box is being sent in request.I am sure you wont find any... HTH. regards, Shirish -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 04, 2003 3:21 PM To: Struts Users Mailing List Subject: Re: Problem with html:select tag calling set method in form Is this the correct functionallity of struts?? if you have a multiple selection list box, and everything is deselected, the setter method in the form object is not getting called. It only gets called if there are 1 or more entries in the list box selected ___ Damian Bradicich Software Developer Scientific Technologies Corporation Tel: (603) 471-4712 Email: [EMAIL PROTECTED] Web Site: www.stchome.com Advancing Public Health Through Information Technology ___ |-+ | | damian_bradicich@| | | stchome.com
Shouldn't this work? html:select property=errorLogTypeID onchange=document.forms[\logFortrykkForm\].submit()
I have a form named logFortrykkForm and I trying to submit the form using the onchange event on a combo box but when I choose something from the box, nothing happens. Isn't this enough..: html:select property=errorLogTypeID onchange=document.forms[logFortrykkForm].submit() --- --- /html:select or am I missing something? Regards, BTJ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shouldn't this work? html:select property=errorLogTypeIDonchange=document.forms[\logFortrykkForm\].submit()
html:select property=errorLogTypeID onchange=document.forms[logFortrykkForm].submit() --- --- /html:select I think it shouldn't have even compiled the JSP, because of the bad parsing of the double quotes. It works with me if I replace the inner double quotes by single quotes: html:select property=errorLogTypeIDonchange=document.forms['logFortrykkForm'].submit( ) [...] Hope it helps Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shouldn't this work? html:select property=errorLogTypeIDonchange=document.forms[\logFortrykkForm\].submit()
Yes, I did some trying back and forth and discovered that... :) But now I have another problem. I found another article that said that I could not use this event and at the same time have a submit button.. And that looks to be correct? But when I need the submit button to submit the rest of the form, how do I solve this? (I just need submit one the onchange event to fill another combobox...) BTJ On Thu, 2003-10-30 at 15:01, Caroline Lauferon wrote: html:select property=errorLogTypeID onchange=document.forms[logFortrykkForm].submit() --- --- /html:select I think it shouldn't have even compiled the JSP, because of the bad parsing of the double quotes. It works with me if I replace the inner double quotes by single quotes: html:select property=errorLogTypeIDonchange=document.forms['logFortrykkForm'].submit( ) [...] Hope it helps Caroline - 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]
Problem with html:select tag calling set method in form
I have a jsp that creates a select tag w/ size = 2 and multiple also true, which gives me a list box w/ multi selection. So, I open up the page, and I see all the data fine, I select a couple of items in the list box and save, everything is great, my setter in the form is getting called. However, if i deselect all entries in the list box, and save, the setter method in the form is not being called, has anyone else noticed this? If so, does anyone have a workaround? ___ Damian Bradicich Software Developer Scientific Technologies Corporation Web Site: www.stchome.com Advancing Public Health Core Capacities While Leveraging the Resources of a Community ___ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:select
how can i default a countrylist, i mean set the selected country ? I want the selected to be 'BE' my code: html:select property=user.countryCode styleClass=contentsmall html:options labelProperty=nam collection=countriesList property=countryId / /html:select Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select
set the country in the action before the page if null - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 30, 2003 1:41 PM Subject: html:select how can i default a countrylist, i mean set the selected country ? I want the selected to be 'BE' my code: html:select property=user.countryCode styleClass=contentsmall html:options labelProperty=nam collection=countriesList property=countryId / /html:select Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:select onchange
Problem how can i pass the userId ? so that i can do a request.getParameter(userId) ? example: html:select property=users.userAccount onchange=setAction('setUpUsersForm.do?action=retrieveuserId= html:options labelProperty=userName collection=userList property=userId / /html:select Thanks !
Re: html:select onchange
Change your custom JavaScript function. Here's an example of what I mean: (change it to fit your needs) form name=SelectURL action=originalUrl.do method=GET select name=users.userAccount onChange=setAction(this.form) option selected value=value1value1/option option value=value2value2/option option value=value3value3/option /select script LANGUAGE=JavaScript function setAction(form) { selectCtl = form.elements[users.userAccount]; form.action = dosomething.do?users.userAccount=; form.action += selectCtl.options[selectCtl.selectedIndex].value; } /script br input type=submit name=submit value=Submit /form -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 770.822.3359 AIM:jmitchtx - Original Message - From: struts [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 6:12 AM Subject: html:select onchange Problem how can i pass the userId ? so that i can do a request.getParameter(userId) ? example: html:select property=users.userAccount onchange=setAction('setUpUsersForm.do?action=retrieveuserId= html:options labelProperty=userName collection=userList property=userId / /html:select Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select onchange
Perhaps you don't need to pass the id in as an argument. I'd just wrap the action in a js function function setupUserForm() { alert( 'setUpUsersForm.do?action=retrieveuserId=c:out value=${param.userId} / ' ); } onchange=setupUserForm() .. On Wednesday, October 29, 2003, at 11:12 AM, struts wrote: Problem how can i pass the userId ? so that i can do a request.getParameter(userId) ? example: html:select property=users.userAccount onchange=setAction('setUpUsersForm.do?action=retrieveuserId= html:options labelProperty=userName collection=userList property=userId / /html:select Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select onchange
In fact ignore my suggestion, I was silly and assumed the userId was taken somewhere else but the form. On Wednesday, October 29, 2003, at 11:33 AM, Mark Lowe wrote: Perhaps you don't need to pass the id in as an argument. I'd just wrap the action in a js function function setupUserForm() { alert( 'setUpUsersForm.do?action=retrieveuserId=c:out value=${param.userId} / ' ); } onchange=setupUserForm() .. On Wednesday, October 29, 2003, at 11:12 AM, struts wrote: Problem how can i pass the userId ? so that i can do a request.getParameter(userId) ? example: html:select property=users.userAccount onchange=setAction('setUpUsersForm.do?action=retrieveuserId= html:options labelProperty=userName collection=userList property=userId / /html:select Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT - JavaScript] Setting value on a html:select/
Been screwing around with this all morning, and can't seem to find an answer. I've got two radio buttons on a form. If the user clicks the second radio button, I need to force the value of a following html:select/ to a specific value, and disable the select. So, using JavaScript, on my radio button I fire an onclick event that run a real simple javascript function. In this function I've tried using document.formName.selectVar.value = default value // is accepted, but the default value isn't passed to my form bean document.formName.selectVar.option[0].selected = true // ditto document.formName.selectVar.option[0].value = default value // ditto document.formName.selectVar.option[0].isSelected = true // ditto JavaScript seems to accept all of these formats, but the setter method in my form bean for 'selectVar' is never getting called. This is going to be a 'Doh!' moment, but how do I do this? TIA! Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT - JavaScript] Setting value on a html:select/
On Wed, 29 Oct 2003, Jerry Jalenak wrote: I've got two radio buttons on a form. If the user clicks the second radio button, I need to force the value of a following html:select/ to a specific value, and disable the select. So, using JavaScript, on my radio button I fire an onclick event that run a real simple javascript function. In this function I've tried using [...] When you say disable the select, are you using the disabled attribute for the select tag to accomplish this? If so, then the value of that form element will not be sent with the HTTP request. If you want them to not change it, set it to readonly instead of disabled. 'Doh!' moment, but how do I do this? TIA! Jerry Jalenak -- Melissa L Kelley [EMAIL PROTECTED] www.stuology.net -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT - JavaScript] Setting value on a html:select/
Not sure, but this may be what you need: (change to your liking) form name=frm action=somewhere.go method=GET script LANGUAGE=JavaScript function forceSelect(form, val, bDisabled){ selectCtl = form.elements[something]; selectCtl.selectedIndex=val; selectCtl.disabled=bDisabled; } /script br input type=radio name=myRadio value=val1 onClick=forceSelect(this.form, 0, false)Val 1br input type=radio name=myRadio value=val2 onClick=forceSelect(this.form, 1, true)Val 2br select name=something option value=- Select One -/option option value=value1value1/option option value=value2value2/option option value=value3value3/option /select input type=submit name=submit value=Submit /form -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 (c) 770.822.3359 (h) AIM:jmitchtx -Original Message- From: Jerry Jalenak [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 11:44 AM To: '[EMAIL PROTECTED]' Subject: [OT - JavaScript] Setting value on a html:select/ Been screwing around with this all morning, and can't seem to find an answer. I've got two radio buttons on a form. If the user clicks the second radio button, I need to force the value of a following html:select/ to a specific value, and disable the select. So, using JavaScript, on my radio button I fire an onclick event that run a real simple javascript function. In this function I've tried using document.formName.selectVar.value = default value // is accepted, but the default value isn't passed to my form bean document.formName.selectVar.option[0].selected = true // ditto document.formName.selectVar.option[0].value = default value // ditto document.formName.selectVar.option[0].isSelected = true // ditto JavaScript seems to accept all of these formats, but the setter method in my form bean for 'selectVar' is never getting called. This is going to be a 'Doh!' moment, but how do I do this? TIA! Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [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: [OT - JavaScript] Setting value on a html:select/
Melissa / James - Thanks for the replies. It does have something to do with setting the 'disabled' attribute to 'true'. Unfortunately, per W3C spec, the select/ tag doesn't support a 'readonly' attribute, only a 'disabled' attribute. Do I need to disable the options? or is there a better way to not allow a user to select a different option? Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Melissa L Kelley [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 11:08 AM To: Struts Users Mailing List Subject: Re: [OT - JavaScript] Setting value on a html:select/ On Wed, 29 Oct 2003, Jerry Jalenak wrote: I've got two radio buttons on a form. If the user clicks the second radio button, I need to force the value of a following html:select/ to a specific value, and disable the select. So, using JavaScript, on my radio button I fire an onclick event that run a real simple javascript function. In this function I've tried using [...] When you say disable the select, are you using the disabled attribute for the select tag to accomplish this? If so, then the value of that form element will not be sent with the HTTP request. If you want them to not change it, set it to readonly instead of disabled. 'Doh!' moment, but how do I do this? TIA! Jerry Jalenak -- Melissa L Kelley [EMAIL PROTECTED] www.stuology.net -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT - JavaScript] Setting value on a html:select/
Disabled controls are not sent - that is an HTTP thing. You can use a hidden field or some other trick to get it there (or rely on the value of the radio button). Last I checked, the first form works only in IE. If you are writing only for IE, that's ok, but it is something to consider. The second works in almost any browser. Larry [EMAIL PROTECTED] 10/29/03 9:44 AM Been screwing around with this all morning, and can't seem to find an answer. I've got two radio buttons on a form. If the user clicks the second radio button, I need to force the value of a following html:select/ to a specific value, and disable the select. So, using JavaScript, on my radio button I fire an onclick event that run a real simple javascript function. In this function I've tried using document.formName.selectVar.value = default value // is accepted, but the default value isn't passed to my form bean document.formName.selectVar.option[0].selected = true // ditto document.formName.selectVar.option[0].value = default value // ditto document.formName.selectVar.option[0].isSelected = true// ditto JavaScript seems to accept all of these formats, but the setter method in my form bean for 'selectVar' is never getting called. This is going to be a 'Doh!' moment, but how do I do this? TIA! Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [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: [OT - JavaScript] Setting value on a html:select/
On Wed, 29 Oct 2003, Jerry Jalenak wrote: Melissa / James - Thanks for the replies. It does have something to do with setting the 'disabled' attribute to 'true'. Unfortunately, per W3C spec, the select/ tag doesn't support a 'readonly' attribute, only a 'disabled' attribute. Do I need to disable the options? or is there a better way to not allow a user to select a different option? You could set all the options but the one you want selected to disabled. I think how it will work in Mozilla is the select menu will still be a drop down, but all the disabled options will be grayed out and not selectable. I don't think IE will support this though. Of course, since you'd be validating on the server side, users who could still select something else would get a nice message telling them that valueB can only be foo when valueA is bar, yes? -- Melissa L Kelley [EMAIL PROTECTED] www.stuology.net -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT - JavaScript] Setting value on a html:select/
Melissa, Tried this under IE and it doesn't work. I guess I'll have to add a hidden field and pass the value I want through it - that way I can disable the select box and still send the value through the request header. Thanks! Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Melissa L Kelley [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 11:39 AM To: Struts Users Mailing List Subject: RE: [OT - JavaScript] Setting value on a html:select/ On Wed, 29 Oct 2003, Jerry Jalenak wrote: Melissa / James - Thanks for the replies. It does have something to do with setting the 'disabled' attribute to 'true'. Unfortunately, per W3C spec, the select/ tag doesn't support a 'readonly' attribute, only a 'disabled' attribute. Do I need to disable the options? or is there a better way to not allow a user to select a different option? You could set all the options but the one you want selected to disabled. I think how it will work in Mozilla is the select menu will still be a drop down, but all the disabled options will be grayed out and not selectable. I don't think IE will support this though. Of course, since you'd be validating on the server side, users who could still select something else would get a nice message telling them that valueB can only be foo when valueA is bar, yes? -- Melissa L Kelley [EMAIL PROTECTED] www.stuology.net -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Pre-populating html:select from request object
I'm trying to pass data between different struts forms. Below I've tried to pre-populate a select statement from data stored in the request but I get a compilation error ( Attribute outageEndDateFromMonth has no value ). html:select property=outageEndDateFromMonth value=%= request.getAttribute(outageEndDateFromMonth) % html:options collection=monthList property=value labelProperty=label / /html:select Any suggestions on how this can be achieved? Thanks Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT - JavaScript] Setting value on a html:select/
The trick I generally use is the onFocus event handler. I think it'll work with select tags: select onFocus=this.blur(); ... /select On Wed, Oct 29, 2003 at 11:11:04AM -0600, Jerry Jalenak wrote: Melissa / James - Thanks for the replies. It does have something to do with setting the 'disabled' attribute to 'true'. Unfortunately, per W3C spec, the select/ tag doesn't support a 'readonly' attribute, only a 'disabled' attribute. Do I need to disable the options? or is there a better way to not allow a user to select a different option? Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Melissa L Kelley [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 11:08 AM To: Struts Users Mailing List Subject: Re: [OT - JavaScript] Setting value on a html:select/ On Wed, 29 Oct 2003, Jerry Jalenak wrote: I've got two radio buttons on a form. If the user clicks the second radio button, I need to force the value of a following html:select/ to a specific value, and disable the select. So, using JavaScript, on my radio button I fire an onclick event that run a real simple javascript function. In this function I've tried using [...] When you say disable the select, are you using the disabled attribute for the select tag to accomplish this? If so, then the value of that form element will not be sent with the HTTP request. If you want them to not change it, set it to readonly instead of disabled. 'Doh!' moment, but how do I do this? TIA! Jerry Jalenak -- Nick Heudecker SystemMobile, Inc. Email: [EMAIL PROTECTED] Web: http://www.systemmobile.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to set an Alt or title messages on a html:select
The site that I am working on has many forms. And to make it easier on the users, I am making descriptions in either the alt attribute or the title attribute of the form, depending on the type. I have found that title works fine for the html:text, and alt works for images, neither of these works for the html:select even though it has both of these attributes. Is there some way to make the info pop up when the cursor is held over the select fields like there is on the text and other fields? Thanks for your help. Jonathon
HTML:SELECT giving headaches
Hi Everyone I'm working on displaying a collection using HTML:SELECT. I'm our case we have a collection of value objects in session scope ,so for e.g in our case we have a collection of Category in session scope ,Which further has a collection of subCategory and I need to display them in a select list in way like Category name1 ...subCategory name1 ...subCategory name2 Category name2 ...subCategory name1 ...subCategory name2 class Category() { String name; String id; Collection subCategory; } Class SubCategory{ String subName; String subID; } So far I'm successfull with first part that is displaying Category name with their id as value ,my code is html:select property=availableList size=18 multiple=true html:options collection=availableFieldList property=lookupType labelProperty=lookupTypeLabel/ /html:select where availableFieldList is the collection of Category , Can anyone suggest few ideas for my second step of displaying subcategories too in required fashion, Thank You This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HTML:SELECT giving headaches
You could do this a couple of ways (thinking out loud here): 1) Do some preprocessing and build a list of all the objects, but I guess that would only work if your SubCategory class had the same properties for name and ID. 2) Do some preprocessing and add ID/name pairs to a SequenceHashMap (org.apache.commons.collections.SequencedHashMap) and use that as your collection. 3) Don't use html:options/ but instead use nested logic:iterate/ tags (for each category, loop over the subcategories in the collection) and use html:option/ tags with name/value pairs. This is probably the best since it is the clearest as to what you are doing, plus you can create the empty spaces more easily. -- Michael D. Norman ProbuSoft -- Custom Software Development http://www.probusoft.com/ 913-390-6951 [EMAIL PROTECTED] -Original Message- From: Sethi, Mandeep [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 9:39 AM To: 'Struts Users Mailing List' Subject: HTML:SELECT giving headaches Hi Everyone I'm working on displaying a collection using HTML:SELECT. I'm our case we have a collection of value objects in session scope ,so for e.g in our case we have a collection of Category in session scope ,Which further has a collection of subCategory and I need to display them in a select list in way like Category name1 ...subCategory name1 ...subCategory name2 Category name2 ...subCategory name1 ...subCategory name2 class Category() { String name; String id; Collection subCategory; } Class SubCategory{ String subName; String subID; } So far I'm successfull with first part that is displaying Category name with their id as value ,my code is html:select property=availableList size=18 multiple=true html:options collection=availableFieldList property=lookupType labelProperty=lookupTypeLabel/ /html:select where availableFieldList is the collection of Category , Can anyone suggest few ideas for my second step of displaying subcategories too in required fashion, Thank You ** ** This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. ** ** - 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 giving headaches - you need OPTGROUP
== categoryForm.subCategoryId} selected=true /c:if % if ( request.getHeader(user-agent).toLowerCase().indexOf(msie 5.0; mac_powerpc) -1 ) { % nbsp;nbsp;nbsp;nbsp; % } else { % % } % c:out value=${currentCategory}/ - c:out value=${currentSubCategory}//option % } % /c:if c:set var=prevCategory value=${subCat.subject_name}/ /c:forEach % if ( request.getHeader(user-agent).toLowerCase().indexOf(win) -1 ) { % /optgroup % } % /hmtl:select Hope this helps - Richard -Original Message- From: Sethi, Mandeep [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 7:39 AM To: 'Struts Users Mailing List' Subject: HTML:SELECT giving headaches Hi Everyone I'm working on displaying a collection using HTML:SELECT. I'm our case we have a collection of value objects in session scope ,so for e.g in our case we have a collection of Category in session scope ,Which further has a collection of subCategory and I need to display them in a select list in way like Category name1 ...subCategory name1 ...subCategory name2 Category name2 ...subCategory name1 ...subCategory name2 class Category() { String name; String id; Collection subCategory; } Class SubCategory{ String subName; String subID; } So far I'm successfull with first part that is displaying Category name with their id as value ,my code is html:select property=availableList size=18 multiple=true html:options collection=availableFieldList property=lookupType labelProperty=lookupTypeLabel/ /html:select where availableFieldList is the collection of Category , Can anyone suggest few ideas for my second step of displaying subcategories too in required fashion, Thank You This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. - 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]
repopulating options of html:select when validation fails
Can anyone offer a crafty method of reloading a dynamic collection of html:options into the request scope in case form validation fails and the controller must forward to the 'input' of the action mapping? Thanks. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HTML:SELECT giving headaches
Hi I eventually ended up using the logic:iterate tag and it worked ,thx For anyone who faced similar error ,my code was html:select property=availableList size=18 multiple=true logic:iterate id=categoryAvailableList name=availableFieldList option value=bean:write name=categoryAvailableList property=lookupType /bean:write name=categoryAvailableList property=lookupTypeLabel / /option logic:present name=categoryAvailableList property=admStuLookupMasterVO logic:iterate id=subcategoryAvailableList name=categoryAvailableList property = admStuLookupMasterVO option value=bean:write name=subcategoryAvailableList property=lookupType /|bean:write name=subcategoryAvailableList property=lookupCode /...bean:write name=subcategoryAvailableList property=lookupDesc / /option /logic:iterate /logic:present /logic:iterate /html:select thxx everybody Mandeep -Original Message- From: Michael D. Norman [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 10:04 AM To: 'Struts Users Mailing List' Subject: RE: HTML:SELECT giving headaches You could do this a couple of ways (thinking out loud here): 1) Do some preprocessing and build a list of all the objects, but I guess that would only work if your SubCategory class had the same properties for name and ID. 2) Do some preprocessing and add ID/name pairs to a SequenceHashMap (org.apache.commons.collections.SequencedHashMap) and use that as your collection. 3) Don't use html:options/ but instead use nested logic:iterate/ tags (for each category, loop over the subcategories in the collection) and use html:option/ tags with name/value pairs. This is probably the best since it is the clearest as to what you are doing, plus you can create the empty spaces more easily. -- Michael D. Norman ProbuSoft -- Custom Software Development http://www.probusoft.com/ 913-390-6951 [EMAIL PROTECTED] -Original Message- From: Sethi, Mandeep [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 9:39 AM To: 'Struts Users Mailing List' Subject: HTML:SELECT giving headaches Hi Everyone I'm working on displaying a collection using HTML:SELECT. I'm our case we have a collection of value objects in session scope ,so for e.g in our case we have a collection of Category in session scope ,Which further has a collection of subCategory and I need to display them in a select list in way like Category name1 ...subCategory name1 ...subCategory name2 Category name2 ...subCategory name1 ...subCategory name2 class Category() { String name; String id; Collection subCategory; } Class SubCategory{ String subName; String subID; } So far I'm successfull with first part that is displaying Category name with their id as value ,my code is html:select property=availableList size=18 multiple=true html:options collection=availableFieldList property=lookupType labelProperty=lookupTypeLabel/ /html:select where availableFieldList is the collection of Category , Can anyone suggest few ideas for my second step of displaying subcategories too in required fashion, Thank You ** ** This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. ** ** - 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] This email may contain confidential material. If you were not an intended recipient, Please notify the sender and delete all copies. We may monitor email to and from our network. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: repopulating options of html:select when validation fails
Can anyone offer a crafty method of reloading a dynamic collection of html:options into the request scope in case form validation fails and the controller must forward to the 'input' of the action mapping? Thanks. Is putting them in session scope totally out of the question? I think a bit of cleanup code is a fair tradeoff for having the collection available when you need it. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: repopulating options of html:select when validation fails
Set your input parameter to the *action* that prepares the page, not directly to the page itself. Steve -Original Message- From: Marc Dugger [mailto:[EMAIL PROTECTED] Sent: October 17, 2003 1:33 PM To: [EMAIL PROTECTED] Subject: repopulating options of html:select when validation fails Can anyone offer a crafty method of reloading a dynamic collection of html:options into the request scope in case form validation fails and the controller must forward to the 'input' of the action mapping? Thanks. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003 - 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: repopulating options of html:select when validation fails
set your input attribute value to the action mapping which set's up the page for display. So if you have SetupAction as the action invoked prior to displaying the page which contains the options collection, then you would use it's action mapping as the input for the action which processes the form input. robert -Original Message- From: Marc Dugger [mailto:[EMAIL PROTECTED] Sent: Friday, October 17, 2003 4:33 PM To: [EMAIL PROTECTED] Subject: repopulating options of html:select when validation fails Can anyone offer a crafty method of reloading a dynamic collection of html:options into the request scope in case form validation fails and the controller must forward to the 'input' of the action mapping? Thanks. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.525 / Virus Database: 322 - Release Date: 10/9/2003 - 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]
logic:iterate tag with html:select
Hi all, I am try it to do a list in the action class and pass it to a jsp page as the html:select options. I am using Strut 1.0. in the action class, I do this: ArrayList codes = new ArrayList(); codes.add(--select one--); request.setAttribute(CODES, codes); in jsp, I try to do: td html:form action=/hospitalsearch html:select property=hospitalCode logic:iterate id=code type=java.util.ArrayList name=CODES indexId=ctr html:option value=%= code.get(ctr) %/ /html:select html:submitsubmit/html:submit /logic:iterate /html:form I got the following errors: Compilation of 'C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_hesm_dir_hesm\jsp_servlet\__hospitalsearch.java' failed: C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_hesm_dir_hesm\jsp_servlet\__hospitalsearch.java:319: cannot resolve symbol probably occurred due to an error in /hospitalsearch.jsp line 52: html:option value=%= code.get(ctr.intValue()) %/ Full compiler error(s): C:\bea\user_projects\domains\mydomain\.\myserver\.wlnotdelete\extract\myserver__appsdir_hesm_dir_hesm\jsp_servlet\__hospitalsearch.java:319: cannot resolve symbol symbol : method setValue (java.lang.Object) location: class org.apache.struts.taglib.html.OptionTag _html_option0.setValue(code.get(ctr.intValue())); //[ /hospitalsearch.jsp; Line: 52] ^ 1 error Do you know how can I make it right? Thanks, katlyn __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I compute data for html:select choices?
For a simple select like this one (months of the year), I use the following code in my work. There is one file, AppStart.java, which contains a servlet that executes at application start. The second part of the code shows what to add to web.xml to make this execute. The last piece of code shows how to use the collection in a jsp page. Wiebe http://frontierj.blogspot.com -- AppStart.java: package com.myco.myapp; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import org.apache.struts.util.LabelValueBean; public class AppStart extends HttpServlet { // a static representation of the MONTHS table private LabelValueBean[] monthTable = { new LabelValueBean(January, 1), new LabelValueBean(February, 2), new LabelValueBean(March, 3), new LabelValueBean(April, 4), new LabelValueBean(May, 5), new LabelValueBean(June, 6), new LabelValueBean(July, 7), new LabelValueBean(August, 8), new LabelValueBean(September, 9), new LabelValueBean(October, 10), new LabelValueBean(November, 11), new LabelValueBean(December, 12) }; // this will execute at startup public void init() throws ServletException { // month list ArrayList monthList = new ArrayList(); for (int i = 0; i monthTable.length; i++) monthList.add(i, monthTable[i]); getServletContext().setAttribute(appMonthList, monthList); } } -- web.xml: servlet servlet-nameappstart/servlet-name servlet-classcom.myco.myapp.AppStart/servlet-class init-param param-namedebug/param-name param-value0/param-value /init-param load-on-startup5/load-on-startup /servlet -- page.jsp: tr tdMonth:/td tdhtml:select property=month html:options collection=appMonthList property=value labelProperty=label/ /html:select/td /tr -- -Original Message- From: Bob Langford [mailto:[EMAIL PROTECTED] Sent: Saturday, October 11, 2003 10:35 AM To: [EMAIL PROTECTED] Subject: How can I compute data for html:select choices? Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How can I compute data for html:select choices?
Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I compute data for html:select choices?
Hi Bob, I think you could try bean:define/ or, better, JSTL tag c:set/. I'm not a JSTL expert but i know you can determine scope to be used by c:set/. And i'm not sure, but i think you can do that also with bean:define/. Hope it helped you. Regards, Daniel. --- Bob Langford [EMAIL PROTECTED] wrote: Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I compute data for html:select choices?
The point of MVC is to pre-populate the bean in Action. You should unit test the bean in the model layer, once it works, put it in Struts. (MVC layered aproach allows for unit testing of a layer) So if you say something like: MyBean b = new MyBean(); b.populate(); Collection c = b.getOptions(); out.println(b); -what do you get? .V A bean that does not work outside of Struts, will not work once you put it in Struts. Daniel H. F. e Silva wrote: Hi Bob, I think you could try bean:define/ or, better, JSTL tag c:set/. I'm not a JSTL expert but i know you can determine scope to be used by c:set/. And i'm not sure, but i think you can do that also with bean:define/. Hope it helped you. Regards, Daniel. --- Bob Langford [EMAIL PROTECTED] wrote: Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- Victor Cekvenich, Struts Instructor (215) 312-9146 Advanced Struts Training http://basebeans.com/do/cmsPg?content=TRAINING Server Side Java training with Rich UI, mentoring, designs, samples and project recovery in North East. Simple best practice basic Portal, a Struts CMS, Membership, Forums, Shopping and Credit processing, http://basicportal.com software, ready to develop/customize; requires a db to run. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I compute data for html:select choices?
i am not sure if you have tried this out: %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=%=months% property=value labelProperty=label / /html:select Cheers ! Ram -Original Message- From: Bob Langford [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Saturday, October 11, 2003 11:05 PM To: [EMAIL PROTECTED] Subject: How can I compute data for html:select choices? Hi, I can't seem to understand how to declare things correctly to do what I want to do. Can anyone tell me where I am going wrong? I'm trying to use a simple Java method as the source of the choices in a html:select box in a form. The method returns a java.util.List, where each item is a org.apache.struts.util.ValueLabelBean object, just what I need for this. Here's one way I tried to use it: = %@ page import=foo.bar.MyUtils % jsp:useBean id=months type=java.util.List / % months = MyUtils.getMonthsList(); % ... html:select ... html:options collection=months property=value labelProperty=label / /html:select = The problem is that useBean looks up the attribute months in the page context, and since it can't find it, throws an exception. But without the useBean tag, the html:options tag can't find the data it needs. I've read the docs until my eyes hurt, and I can't find any technique to tell useBean to merely create a new bean, not fetch an existing one. This seems so easy, I can't believe I haven't done it before, but I can't find an example in any of my previous code. What am I missing? Thanks in advance... -- Bob Langford Silicon Masters Consulting, Inc.8207 Stone River Court, Richmond, VA 23235 phone: 804-674-1253 fax: 804-745-6650 http://www.silicon-masters.com/ http://www.silicon-masters.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. **
problem using html:select
Hello: This is my litle problem I make a sample in struts that register data from the users, this data is save in one table (Users), the JSP have a field call Cargo (I'm from southamerica - cargo is like a ocupation), in this field the user enter the ocupation manualy, but now I want that the user select the Cargo(ocupation - this ocupations are in another table) from a combo, I can show the combobox with the data from de table ocupations using a bean and the tag html:select. jsp:useBean id=cargo class=beans.Cargos scope=request/ html:select name='cargo' property=nombre html:option value=0--select--/html:option html:optionsCollection name='cargo' label='nombre' value='codigo' property='cargos' / /html:select but now I cant recive tha value selected in the combo in my User form. I think that the problem was the value of the atribute property of tha select tag, but when i change the value of the property entering a name of the variable for my user form occurs a error, because property just accept the name of a variable of my Cargo bean. Whats is the problem with this??? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem using html:select
What is the error message you are getting? - Original Message - From: Carlos Llona [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 01, 2003 11:57 AM Subject: problem using html:select Hello: This is my litle problem I make a sample in struts that register data from the users, this data is save in one table (Users), the JSP have a field call Cargo (I'm from southamerica - cargo is like a ocupation), in this field the user enter the ocupation manualy, but now I want that the user select the Cargo(ocupation - this ocupations are in another table) from a combo, I can show the combobox with the data from de table ocupations using a bean and the tag html:select. jsp:useBean id=cargo class=beans.Cargos scope=request/ html:select name='cargo' property=nombre html:option value=0--select--/html:option html:optionsCollection name='cargo' label='nombre' value='codigo' property='cargos' / /html:select but now I cant recive tha value selected in the combo in my User form. I think that the problem was the value of the atribute property of tha select tag, but when i change the value of the property entering a name of the variable for my user form occurs a error, because property just accept the name of a variable of my Cargo bean. Whats is the problem with this??? - 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: problem using html:select
the problem is that now using the combo I cant obtein the value selected when I submit - the user form cant recive the value, and I dont know why!! I dont know how to connect my combobox with one variable of the user form, before I used the atribute property using a hmlt:text, now I dont know how to match :( From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: problem using html:select Date: Wed, 1 Oct 2003 12:46:10 -0400 What is the error message you are getting? - Original Message - From: Carlos Llona [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 01, 2003 11:57 AM Subject: problem using html:select Hello: This is my litle problem I make a sample in struts that register data from the users, this data is save in one table (Users), the JSP have a field call Cargo (I'm from southamerica - cargo is like a ocupation), in this field the user enter the ocupation manualy, but now I want that the user select the Cargo(ocupation - this ocupations are in another table) from a combo, I can show the combobox with the data from de table ocupations using a bean and the tag html:select. jsp:useBean id=cargo class=beans.Cargos scope=request/ html:select name='cargo' property=nombre html:option value=0--select--/html:option html:optionsCollection name='cargo' label='nombre' value='codigo' property='cargos' / /html:select but now I cant recive tha value selected in the combo in my User form. I think that the problem was the value of the atribute property of tha select tag, but when i change the value of the property entering a name of the variable for my user form occurs a error, because property just accept the name of a variable of my Cargo bean. Whats is the problem with this??? - 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] _ ¿Estás buscando un auto nuevo? http://www.yupimsn.com/autos/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: problem using html:select
The 'property' attribute of the select tag is the form property submitted. You don't need to use the name property in the select tag, it's used there to indicate which bean to get a value from in order to pre-select an item in the options. Try this: html:select property=nombre html:options collection=cargo property=codigo labelProperty=nombre/ /html:select or html:select property=nombre html:optionsCollection name=cargo value=codigo label=nombre/ /html:select If you do want to pre-select an option add the 'value' attribute to the select tag. Greg -Original Message- From: carlos manuel llona aris [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 01, 2003 2:07 PM To: [EMAIL PROTECTED] Subject: Re: problem using html:select the problem is that now using the combo I cant obtein the value selected when I submit - the user form cant recive the value, and I dont know why!! I dont know how to connect my combobox with one variable of the user form, before I used the atribute property using a hmlt:text, now I dont know how to match :( From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: problem using html:select Date: Wed, 1 Oct 2003 12:46:10 -0400 What is the error message you are getting? - Original Message - From: Carlos Llona [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 01, 2003 11:57 AM Subject: problem using html:select Hello: This is my litle problem I make a sample in struts that register data from the users, this data is save in one table (Users), the JSP have a field call Cargo (I'm from southamerica - cargo is like a ocupation), in this field the user enter the ocupation manualy, but now I want that the user select the Cargo(ocupation - this ocupations are in another table) from a combo, I can show the combobox with the data from de table ocupations using a bean and the tag html:select. jsp:useBean id=cargo class=beans.Cargos scope=request/ html:select name='cargo' property=nombre html:option value=0--select--/html:option html:optionsCollection name='cargo' label='nombre' value='codigo' property='cargos' / /html:select but now I cant recive tha value selected in the combo in my User form. I think that the problem was the value of the atribute property of tha select tag, but when i change the value of the property entering a name of the variable for my user form occurs a error, because property just accept the name of a variable of my Cargo bean. Whats is the problem with this??? - 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] _ ¿Estás buscando un auto nuevo? http://www.yupimsn.com/autos/ - 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]
Problem updating values from html:select
Folks, I have the following jsp that is giving me a headache. My ActionForm contains a Collection of Device objects. The outer loop iterates over each device. Each Device contains a Collection of Parameter objects. The inner loop iterates over each parameter. The problem comes in the html:select The values are displaying properly on the screen, but they are not updating during the submit. I am not getting any errors or anything .. Just no updated values. Can anyone provide some insight? Thanks! logic:iterate name=configureWorkstationForm property=devices id=device html:form action=/configureWorkstationAction bDevice Name:/b bean:write name=device property=name /br / bDevice Type:/b bean:write name=device property=type.name /br / bSettings:/b table logic:iterate name=device property=type.parameters id=parameter tdbean:define id=parameterId name=parameter property=id / tr tdbean:write name=parameter property=name /:/td td html:select name=device property='%=deviceParameterValue[ + parameterId + ]%' html:optionsCollection name=parameter property=parameterValues label=value value=value / /html:select /td /tr /logic:iterate /table input type=hidden name=currentDevice value=%=((DeviceVO)device).getId()% / html:submit property=submitButton value=Delete / html:submit property=submitButton value=Save / /html:form /logic:iterate - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem updating values from html:select
You did make the indexed setters in your Form, right? m Hajratwala, Nayan (N.) [EMAIL PROTECTED]wrote: Folks, I have the following jsp that is giving me a headache. My ActionForm contains a Collection of Device objects. The outer loop iterates over each device. Each Device contains a Collection of Parameter objects. The inner loop iterates over each parameter. The problem comes in the The values are displaying properly on the screen, but they are not updating during the submit. I am not getting any errors or anything .. Just no updated values. Can anyone provide some insight? Thanks! Device Name: Device Type: Settings: : ' [input] name=currentDevice - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software