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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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
I believe that what you really are wanting to do is use the OPTGROUP tag within HTML's select tag. This allows you to create a two level indented list of categories and subcategories in a select list. Unfortunately Struts does not directly support this. I asked about this a couple of months ago - and got no response at all. I imagine the lack of support is for two reasons: 1) The data structure to support it would be slightly more complicated - a collection of category object, each category object would need a few properties and a collection of (sub)category objects. 2) The browser support for OPTGROUP has been spotty until recently. Under Windows it was not supported in MSIE until version 5.5 (IIRC) and with Netscape support started in version 6 (again, IIRC). However the OPTGROUP is supposed to degrade gracefully in older browsers and still be usable - not so sure about that. If the browser support is not an issue, then you can still OPTGROUP with struts - IF you are willing to do a little scripting (or even better create your own custom tag). We do and are very pleased with the results, although we have had to make some minor adjustments to support different browsers on different platforms. Here are a couple of references that should be useful. http://www.w3.org/TR/REC-html40/interact/forms.html#edef-OPTGROUP http://tagsnstyles.host.sk/elements/optgroup.html Here is a snippet of the code that I use in my JSP to create the indented select lists (I did change variable names to be a little more general and removed a few complexities). I ended up using a combination of JSTL and JSP scriptlets (not pretty, but it works). If we decide to use this on a more widespread basis,a custom taglib is definitely in order. I've included two versions, the first only works with Windows and MSIE 6.0, Netscape 7.x and Mozilla Firebird (may work with other browsers, but not tested). The second also works with Macintosh MSIE 5.1 - turns out that Mac MSIE 5.1 has quite a few differences - you would think both being written by MS, they might ... I know, the problem is I thought - :(. Have not had a chance to test under Macintosh Safari, maybe it will not be so picky. Anyway, this is not elegant at all, but it works and the effect is quite nice. SNIPPET - Supports Windows only (see above) hmtl:select property=subCategoryId indexed=true styleId=newsubCategoryId optgroup label= option value= label=nbsp;/option /optgroup c:set var=prevCategory value=/ c:forEach items=${Collection_SubCategory} var=subCat c:set var=currentCategory value=${subCat.subject_name}/ c:set var=currentSubCategory value=${subCat.name}/ c:if test=${prevCategory != currentCategory} c:if test=${!empty prevCategory} /optgroup /c:if /c:if c:if test=${prevCategory != currentCategory !empty currentSubCategory} optgroup label=c:out value=${currentCategory}/ /c:if c:if test=${currentSubCategory != ''} option value=c:out value=${subCat.id}/ label=c:out value=${currentSubCategory}/ c:if test=${subCat.id == categoryForm.subCategoryId} selected=true /c:if c:out value=${currentSubCategory}//option /c:if c:set var=prevCategory value=${subCat.subject_name}/ /c:forEach /optgroup /hmtl:select SNIPPET - Supports Windows and Mac (see above) hmtl:select property=subCategoryId indexed=true styleId=newsubCategoryId % if ( request.getHeader(user-agent).toLowerCase().indexOf(win) -1 ) { % optgroup label= option value= label=nbsp;/option /optgroup % } else { % option value=nbsp;/option % } % c:set var=prevCategory value=/ c:forEach items=${Collection_SubCategory} var=subCat c:set var=currentCategory value=${subCat.subject_name}/ c:set var=currentSubCategory value=${subCat.name}/ % if ( request.getHeader(user-agent).toLowerCase().indexOf(win) -1 ) { % c:if test=${prevCategory != currentCategory} c:if test=${!empty prevCategory} /optgroup /c:if /c:if c:if test=${prevCategory != currentCategory !empty currentSubCategory} optgroup label=c:out value=${currentCategory}/ /c:if % } else { % c:if test=${prevCategory != currentCategory !empty currentSubCategory} option value=c:out value=${currentCategory}/ readonly=true style=font-weight: bold; c:out value=${currentCategory}/ /option /c:if % } % c:if test=${currentSubCategory != ''} % if ( request.getHeader(user-agent).toLowerCase().indexOf(win) -1 ) { % option value=c:out value=${subCat.id}/ label=c:out value=${currentSubCategory}/ c:if test=${subCat.id == categoryForm.subCategoryId} selected=true /c:if c:out value=${currentSubCategory}//option % } else { % option value=c:out value=${subCat.id}/ c:if test=${subCat.id ==
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: html:select multiple=true and ActionForm
Minor correction: public String[] getSelectedProductValues() should be public ArrayList getSelectedProductValues() Ian Joyce Internet Systems Programmer/Analyst American Academy of Family Physicians Research and Information Services Interactive Media 11400 Tomahawk Creek Parkway Leawood, KS 66211-2672 Phone: 800-274-2237 ext 4219 Fax: 913-906-6271 E-mail: [EMAIL PROTECTED] [EMAIL PROTECTED] 09/18/03 01:06 AM I've looked in the archives and googled but haven't come up with a solution yet. I have a html:select multiple=true form element. When the form is submitted what setter should be called in the ActionForm? My form 8---8--- html:select property=selectedProductValues multiple=true html:options property=selectedProductValues labelProperty=selectedProductValues / /html:select 8---8--- my ActionForm ( not working ) 8---8--- public final class ProductsForm extends ActionForm { private ArrayList selectedProductValues = null; public void setSelectedProductValues(ArrayList selectedProductValues) { this.selectedProductValues = selectedProductValues; } public String[] getSelectedProductValues() { return this.selectedProductValues; } } 8---8--- Thanks for any help... - 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
Hi, Can someone help out with the usage of html:select. The API just gives the syntax ans the parameters that can be used with place. I understand that it can be used with combo boxes. I have to poulate a combo box using this. Thanks, Seshadhri Srinivasan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select Not 'Selecting' My Item
I do mine like this, haven't had a problem yet. bean:define id=sList name=yourForm property=statusList scope=request / html:select property=statusId html:options collection=sList property=id labelProperty=status/ /html:select From: Hunter Hillegas [EMAIL PROTECTED] Date: 2003/08/18 Mon AM 11:38:10 EDT To: Struts List [EMAIL PROTECTED] Subject: html:select Not 'Selecting' My Item I sent a similar question to the list last week and didn't see any responses. I'm resending as I'm still having this problem. I have an html:select tag that isn't playing along... I pre-populate a form in an action. I also create a TreeMap and add it to the request scope. I have the following in my JSP: html:select property=associatedSalesperson name=sampleRequestCompleteForm value=encodeAssociatedSalespersonID html:options collection=assocatedSalespeople property=key labelProperty=value/ /html:select The problem is not that the map doesn't display as options, they do, that is fine. The problem is that the correct item isn't highlighted. No item is highlighted (default, top item). I have a println() in my getEncodeAssociatedSalespersonID() method in my ActionForm and it doesn't appear that it is being called. Isn't this supposed to be evaluated? My understanding is that if the key of the option matches the evaluated value of the 'value' attribute of the html:select, it should show as SELECTED. Is that true? What am I doing wrong? TIA, hunter - 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 Not 'Selecting' My Item
Thanks but I think I am trying to do something a little different. The method I need called to evaluate which item is selected isn't getting called... getEncodeAssociatedSalespersonID() has some logging stuff in it that never gets printed... Any idea what I am doing wrong? From: Craig Margenau [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 11:47:08 -0400 To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: html:select Not 'Selecting' My Item I do mine like this, haven't had a problem yet. bean:define id=sList name=yourForm property=statusList scope=request / html:select property=statusId html:options collection=sList property=id labelProperty=status/ /html:select From: Hunter Hillegas [EMAIL PROTECTED] Date: 2003/08/18 Mon AM 11:38:10 EDT To: Struts List [EMAIL PROTECTED] Subject: html:select Not 'Selecting' My Item I sent a similar question to the list last week and didn't see any responses. I'm resending as I'm still having this problem. I have an html:select tag that isn't playing along... I pre-populate a form in an action. I also create a TreeMap and add it to the request scope. I have the following in my JSP: html:select property=associatedSalesperson name=sampleRequestCompleteForm value=encodeAssociatedSalespersonID html:options collection=assocatedSalespeople property=key labelProperty=value/ /html:select The problem is not that the map doesn't display as options, they do, that is fine. The problem is that the correct item isn't highlighted. No item is highlighted (default, top item). I have a println() in my getEncodeAssociatedSalespersonID() method in my ActionForm and it doesn't appear that it is being called. Isn't this supposed to be evaluated? My understanding is that if the key of the option matches the evaluated value of the 'value' attribute of the html:select, it should show as SELECTED. Is that true? What am I doing wrong? TIA, hunter - 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: Re: html:select Not 'Selecting' My Item
Looks like you are doing the same thing I am just in a slightly different manner. I prepopulate default values for my action form in my action class, including an ArrayList named statusList to hold dropdown values, rather than using a separate request attribute..that being the only difference that I can see. My statusList ArrayList hold an array of a simple Status class that defines an id and value attribute. One of my action form attributes is statusId and is the value I prepopulate in my action calss and wish to be selected when my form is displayed. The object 'assocatedSalespeople that your html:option collection param is referring to is supposed to be a jsp scripting variable...I'm assuming you've set this elsewhere in your jsp's code? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select Not 'Selecting' My Item
Yes, associatedSalespeople is set in an Action. The list displays properly, that's not a problem. The only issue is that the correct item isn't selected. associatedSalespeople is a TreeMap with key/value pairs. The value of 'encodeAssociatedSalespersonID' matches one of the keys but it doesn't seem that this property is evaluated at all since the debug output is never printed to the log. Hunter From: Craig Margenau [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 15:16:13 -0400 To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Re: html:select Not 'Selecting' My Item Looks like you are doing the same thing I am just in a slightly different manner. I prepopulate default values for my action form in my action class, including an ArrayList named statusList to hold dropdown values, rather than using a separate request attribute..that being the only difference that I can see. My statusList ArrayList hold an array of a simple Status class that defines an id and value attribute. One of my action form attributes is statusId and is the value I prepopulate in my action calss and wish to be selected when my form is displayed. The object 'assocatedSalespeople that your html:option collection param is referring to is supposed to be a jsp scripting variable...I'm assuming you've set this elsewhere in your jsp's code? - 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 Not 'Selecting' My Item
Don't rely on debug output when dealing with getters and setters for Forms. It's been my experience that this can be deceptive, since Struts apparently uses reflection when dealing with Form member variables. What HTML is being generated for your select tag, and are any of the associated option tags set to selected=selected? -= J -Original Message- From: Hunter Hillegas [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 2:37 PM To: Struts List; Craig Margenau Subject: Re: html:select Not 'Selecting' My Item Yes, associatedSalespeople is set in an Action. The list displays properly, that's not a problem. The only issue is that the correct item isn't selected. associatedSalespeople is a TreeMap with key/value pairs. The value of 'encodeAssociatedSalespersonID' matches one of the keys but it doesn't seem that this property is evaluated at all since the debug output is never printed to the log. Hunter From: Craig Margenau [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 15:16:13 -0400 To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Re: html:select Not 'Selecting' My Item Looks like you are doing the same thing I am just in a slightly different manner. I prepopulate default values for my action form in my action class, including an ArrayList named statusList to hold dropdown values, rather than using a separate request attribute..that being the only difference that I can see. My statusList ArrayList hold an array of a simple Status class that defines an id and value attribute. One of my action form attributes is statusId and is the value I prepopulate in my action calss and wish to be selected when my form is displayed. The object 'assocatedSalespeople that your html:option collection param is referring to is supposed to be a jsp scripting variable...I'm assuming you've set this elsewhere in your jsp's code? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select Not 'Selecting' My Item
On Mon, 18 Aug 2003, James Childers wrote: Don't rely on debug output when dealing with getters and setters for Forms. It's been my experience that this can be deceptive, since Struts apparently uses reflection when dealing with Form member variables. While it is true that reflection is used, the property getter and setter methods are still called. Struts does not introspect the instance variables of the bean; indeed, it does not care whether there even is such a thing. All it cares about is the getter and setter Method values returned in the PropertyDescriptor for a particular property. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select Not 'Selecting' My Item
Hunter, Do you have an associatedSalesperson attribute in your FormBean? If so, what is it's value? You shouldn't really have to use the value attribute if you set the associatedSalesperson attribute to the desired id in associatedSalesPeople. -Richard -Original Message- From: Hunter Hillegas [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 9:04 AM To: Struts List Subject: html:select Not 'Selecting' My Item I have an html:select tag that isn't playing along... I pre-populate a form in an action. I also create a TreeMap and add it to the request scope. I have the following in my JSP: html:select property=associatedSalesperson name=sampleRequestCompleteForm value=encodeAssociatedSalespersonID html:options collection=assocatedSalespeople property=key labelProperty=value/ /html:select The problem is not that the map doesn't display as options, they do, that is fine. The problem is that the correct item isn't highlighted. No item is highlighted (default, top item). I have a println() in my getEncodeAssociatedSalespersonID() method in my ActionForm and it doesn't appear that it is being called. Isn't this supposed to be evaluated. My understanding is that if the key of the option matches the evaluated value of the 'value' attribute of the html:select, it should show as SELECTED. Is that true? What am I doing wrong? TIA, hunter - 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 Not 'Selecting' My Item
The HTML generated for the select looks as follows: select name=associatedSalesperson option value=Jobs-8Jobs, Steve/option option value=Bob-7Bob, Darin/option option value=Bob-27Bob, Philip/option option value=Bob-32Bob, Glenn/option /select None of the options are selected. In this example the getEncodeAssociatedSalespersonID() returns Bob-7. I also tried it retunring 'Bob, Darin'. Still, the item is not selected. From: James Childers [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 14:44:53 -0500 To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: html:select Not 'Selecting' My Item Don't rely on debug output when dealing with getters and setters for Forms. It's been my experience that this can be deceptive, since Struts apparently uses reflection when dealing with Form member variables. What HTML is being generated for your select tag, and are any of the associated option tags set to selected=selected? -= J -Original Message- From: Hunter Hillegas [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 2:37 PM To: Struts List; Craig Margenau Subject: Re: html:select Not 'Selecting' My Item Yes, associatedSalespeople is set in an Action. The list displays properly, that's not a problem. The only issue is that the correct item isn't selected. associatedSalespeople is a TreeMap with key/value pairs. The value of 'encodeAssociatedSalespersonID' matches one of the keys but it doesn't seem that this property is evaluated at all since the debug output is never printed to the log. Hunter From: Craig Margenau [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 15:16:13 -0400 To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Re: html:select Not 'Selecting' My Item Looks like you are doing the same thing I am just in a slightly different manner. I prepopulate default values for my action form in my action class, including an ArrayList named statusList to hold dropdown values, rather than using a separate request attribute..that being the only difference that I can see. My statusList ArrayList hold an array of a simple Status class that defines an id and value attribute. One of my action form attributes is statusId and is the value I prepopulate in my action calss and wish to be selected when my form is displayed. The object 'assocatedSalespeople that your html:option collection param is referring to is supposed to be a jsp scripting variable...I'm assuming you've set this elsewhere in your jsp's code? - 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 Not 'Selecting' My Item
Richard, Yes, I do. I was hoping the value attribute would let me override which property of my form bean was being used to check for the match. Is that not the case? Thanks, Hunter From: Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 16:52:06 -0400 To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: html:select Not 'Selecting' My Item Hunter, Do you have an associatedSalesperson attribute in your FormBean? If so, what is it's value? You shouldn't really have to use the value attribute if you set the associatedSalesperson attribute to the desired id in associatedSalesPeople. -Richard -Original Message- From: Hunter Hillegas [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 9:04 AM To: Struts List Subject: html:select Not 'Selecting' My Item I have an html:select tag that isn't playing along... I pre-populate a form in an action. I also create a TreeMap and add it to the request scope. I have the following in my JSP: html:select property=associatedSalesperson name=sampleRequestCompleteForm value=encodeAssociatedSalespersonID html:options collection=assocatedSalespeople property=key labelProperty=value/ /html:select The problem is not that the map doesn't display as options, they do, that is fine. The problem is that the correct item isn't highlighted. No item is highlighted (default, top item). I have a println() in my getEncodeAssociatedSalespersonID() method in my ActionForm and it doesn't appear that it is being called. Isn't this supposed to be evaluated. My understanding is that if the key of the option matches the evaluated value of the 'value' attribute of the html:select, it should show as SELECTED. Is that true? What am I doing wrong? TIA, hunter - 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 Not 'Selecting' My Item
Hunter wrote: The HTML generated for the select looks as follows: select name=associatedSalesperson None of the options are selected. In this example the getEncodeAssociatedSalespersonID() returns Bob-7. I also tried it retunring 'Bob, Darin'. Still, the item is not selected. Those names don't match! Change the name of the 'get' method to 'getAssociatedSalesperson' and see if things improve. In an earlier message, you wrote: html:select property=associatedSalesperson name=sampleRequestCompleteForm value=encodeAssociatedSalespersonID The 'property' in the html:select tag needs to match the get/set methods. You DO NOT need to use the 'value' attribute, Struts will automatically pre-select the right value based on what's in the Form bean. (I'm almost certain I answered this last week... Hopefully I haven't contradicted myself!) -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM
RE: html:select Not 'Selecting' My Item
I was hoping the value attribute would let me override which property of my form bean was being used to check for the match. Is that not the case? No, 'value' is where you would put the literal value of the option you want to be selected. Take a look here: http://jakarta.apache.org/struts/userGuide/struts-html.html#select For 'value' it says: The value to compare with for marking an option selected. Nothing about using whatever you put in value as the name of a different form property. Where did you get that idea? -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM
Re: html:select Not 'Selecting' My Item
From: Wendy Smoak [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 14:06:06 -0700 To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: html:select Not 'Selecting' My Item Hunter wrote: The HTML generated for the select looks as follows: select name=associatedSalesperson None of the options are selected. In this example the getEncodeAssociatedSalespersonID() returns Bob-7. I also tried it retunring 'Bob, Darin'. Still, the item is not selected. Those names don't match! Change the name of the 'get' method to 'getAssociatedSalesperson' and see if things improve. I thought I could use value to override what property was being used to determine which item was selected. I cannot use associatedSalesperson as my matching item. It won't match. We do some processing on the input before we put it in our database... That's what I want to use the other method to output a string that will match. In an earlier message, you wrote: html:select property=associatedSalesperson name=sampleRequestCompleteForm value=encodeAssociatedSalespersonID The 'property' in the html:select tag needs to match the get/set methods. You DO NOT need to use the 'value' attribute, Struts will automatically pre-select the right value based on what's in the Form bean. (I'm almost certain I answered this last week... Hopefully I haven't contradicted myself!) I thought I could use value to override. I don't want the default behavior here. Please see above. Thanks, Hunter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select Not 'Selecting' My Item
This may be the crux of my problem. For some reason (not immediately sure why), I thought I could have the contents of 'value' evaluated (i.e. value='${myOtherProperty}'). You're saying that this is not the case? If that's true, how would I get the effect I require? Thanks very much for your help. Hunter From: Wendy Smoak [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 14:09:22 -0700 To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: html:select Not 'Selecting' My Item No, 'value' is where you would put the literal value of the option you want to be selected. Take a look here: http://jakarta.apache.org/struts/userGuide/struts-html.html#select For 'value' it says: The value to compare with for marking an option selected. Nothing about using whatever you put in value as the name of a different form property. Where did you get that idea? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select Not 'Selecting' My Item
Hunter, In your Action, if you set the value of associatedSalesperson = getEncodeAssociatedSalespersonID(), then it should fix your problem. Once the form gets submitted, you can then do some processing on the value of associatedSalesperson before writing the value to your database. Either way, associatedSalesperson is going to get the one of the values (Jobs-8,Bob-7,Bob-27, or Bob-32). Regards, Richard -Original Message- From: Hunter Hillegas [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 2:21 PM To: Struts List Subject: Re: html:select Not 'Selecting' My Item This may be the crux of my problem. For some reason (not immediately sure why), I thought I could have the contents of 'value' evaluated (i.e. value='${myOtherProperty}'). You're saying that this is not the case? If that's true, how would I get the effect I require? Thanks very much for your help. Hunter From: Wendy Smoak [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] Date: Mon, 18 Aug 2003 14:09:22 -0700 To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: html:select Not 'Selecting' My Item No, 'value' is where you would put the literal value of the option you want to be selected. Take a look here: http://jakarta.apache.org/struts/userGuide/struts-html.html#select For 'value' it says: The value to compare with for marking an option selected. Nothing about using whatever you put in value as the name of a different form property. Where did you get that idea? - 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 Not 'Selecting' My Item
For some reason (not immediately sure why), I thought I could have the contents of 'value' evaluated (i.e. value='${myOtherProperty}'). You're saying that this is not the case? If that's true, how would I get the effect I require? You can... If you switch to the EL tags. Look in the 'contrib' directory, and get the .jar files in there. Read the README file. Change your @taglib at the top to: %@ taglib uri=http://jakarta.apache.org/struts/tags-html-el; prefix=html-el % Then use the syntax you have above, something like: html-el:select property=associatedSalesperson value=${encodedAssociatedSalespersonID} From memory... play with syntax and spelling as necessary to get it to do what you want. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM
Re: html:select multiple and validationForm?
- Original Message - From: Terje Hopsø [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, August 15, 2003 12:32 AM Subject: RE: html:select multiple and validationForm? I have both and only the one I mentioned is called. - Terje You can`t have both! Just one - with String[] or String as its argument. If you have two setters only thsi with String argument. This is a bug in struts ( or a feature - as you wish ). Jacek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select multiple and validationForm?
Thanks!! Now it works! Three days of trying and crying is over. Where can I find this bug list? - Terje -Original Message- From: Jacek Zoch [mailto:[EMAIL PROTECTED] Sent: 15. august 2003 10:46 To: Struts Users Mailing List Subject: Re: html:select multiple and validationForm? - Original Message - From: Terje Hopsø [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, August 15, 2003 12:32 AM Subject: RE: html:select multiple and validationForm? I have both and only the one I mentioned is called. - Terje You can`t have both! Just one - with String[] or String as its argument. If you have two setters only thsi with String argument. This is a bug in struts ( or a feature - as you wish ). Jacek - 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 multiple and validationForm?
- Original Message - From: Terje Hopsø [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, August 15, 2003 1:49 PM Subject: RE: html:select multiple and validationForm? Thanks!! Now it works! Three days of trying and crying is over. Where can I find this bug list? - Terje I have found it myself after days of trying and crying :-) I am not sure, if it is a bug or struts just work so. Jacek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select problem
Thanks. yes, the userBean is the actionform associated with the jsp page. I tried it using the below given code..i used userID instead of user ..just for test.. html:select name=userDataBean property=userID html:optionsCollection name=userDataBean property=roleUser label =roleID value=desc / /html:select But it's giving me below given error..though the userDataBean is having the getter method for the userID .. No getter method available for property userID for bean under name userDataBean' bye, prashant.. Nagendra Kumar O V S To: [EMAIL PROTECTED] [EMAIL PROTECTED]cc: go.com Subject: Re: html:select problem 08/11/03 06:27 PM Please respond to Struts Users Mailing List hi, u r not v clear in ur question is userBean, the action form associated with the jsp page..?? if yes. then html:select name=userDataBean property=user html:optionsCollection name=userDataBean property=roleUser label=roleid value=desc / /html:select should work for u the property user should also be in the action form, which holds the value of the client selected in the drop down on the form submit -- nagi ---Original Message--- From: Struts Users Mailing List Date: Monday, August 11, 2003 06:03:01 PM To: [EMAIL PROTECTED] Subject: ?XML:NAMESPACE PREFIX = HTML / problem Hi, I have a problem handling nested beans.. For example... I have a userBean as given below private int userID; private String lastName; private String firstName
Re: html:select problem
Thanks, yes, the userBean is the actionform associated with the jsp page. I tried it using the below given code..i used userID instead of user ..just for test.. html:select name=userDataBean property=userID html:optionsCollection name=userDataBean property=roleUser label =roleID value=desc / /html:select But it's giving me Nagendra Kumar O V S To: [EMAIL PROTECTED] [EMAIL PROTECTED]cc: go.com Subject: Re: html:select problem 08/11/03 06:27 PM Please respond to Struts Users Mailing List hi, u r not v clear in ur question is userBean, the action form associated with the jsp page..?? if yes. then html:select name=userDataBean property=user html:optionsCollection name=userDataBean property=roleUser label=roleid value=desc / /html:select should work for u the property user should also be in the action form, which holds the value of the client selected in the drop down on the form submit -- nagi ---Original Message--- From: Struts Users Mailing List Date: Monday, August 11, 2003 06:03:01 PM To: [EMAIL PROTECTED] Subject: ?XML:NAMESPACE PREFIX = HTML / problem Hi, I have a problem handling nested beans.. For example... I have a userBean as given below private int userID; private String lastName; private String firstName; private ArrayList roleUser; Where the last field Arraylist is the arraylist of the objects
Re: html:select problem
hi, u r not v clear in ur question is userBean, the action form associated with the jsp page..?? if yes. then html:select name="userDataBean" property="user"html:optionsCollection name="userDataBean" property="roleUser" label="roleid" value="desc" //html:selectshould work for u the property "user" should also be in the action form, which holds the value of the client selected in the drop down on the form submit -- nagi ---Original Message--- From: Struts Users Mailing List Date: Monday, August 11, 2003 06:03:01 PM To: [EMAIL PROTECTED] Subject: problemHi, I have a problem handling nested beans.. For example... I have a userBean as given below private int userID; private String lastName; private String firstName; private ArrayList roleUser; Where the last field Arraylist is the arraylist of the objects of the beancalled roleUserBean. Again the roleUserBean has the following properties. private int roleid; private String desc; private String name; private ArrayList menuComponent; I have put the userBean in the session scope. Now I want to show all theelements in the ArrayList roleUser in a drop down. I am trying to use thehtml:select tag. But it's giving me errors.What I am doing is:bean:define id="roleuser" name="userDataBean" property="roleUser" scope="session" type="java.util.ArrayList"/html:select name="userDataBean" property="roleUser" html:options collection="roleuser" labelProperty="roleID" property="desc" //html:select:Please help .. Thanks in advance. Prashant M Desai.-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]. IncrediMail - Email has finally evolved - Click Here
Re: html:select multiple and validationForm?
- Original Message - From: Terje Hopsø [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, August 14, 2003 11:48 PM Subject: html:select multiple and validationForm? Hello, I have a html:select.. where I show a listbox where I can select multiple records. But I only get the first selected entry into my validationForm. The setNavn(String navn) is the one that is executed when submitting my form. What is wrong? VALIDATIONFORM-CODE: public void setNavn(String navn) { System.out.println(Yes, I have been called); } Try : public void setNavn(String[] navn) { System.out.println(Yes, I have been called); } Jacek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select multiple and validationForm?
I have both and only the one I mentioned is called. - Terje -Original Message- From: Jacek Zoch [mailto:[EMAIL PROTECTED] Sent: 15. august 2003 00:17 To: Struts Users Mailing List Subject: Re: html:select multiple and validationForm? - Original Message - From: Terje Hopsø [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, August 14, 2003 11:48 PM Subject: html:select multiple and validationForm? Hello, I have a html:select.. where I show a listbox where I can select multiple records. But I only get the first selected entry into my validationForm. The setNavn(String navn) is the one that is executed when submitting my form. What is wrong? VALIDATIONFORM-CODE: public void setNavn(String navn) { System.out.println(Yes, I have been called); } Try : public void setNavn(String[] navn) { System.out.println(Yes, I have been called); } Jacek - 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 problem
Thanks. yes, the userBean is the actionform associated with the jsp page. I tried it using the below given code..i used userID instead of user ..just for test.. html:select name=userDataBean property=userID html:optionsCollection name=userDataBean property=roleUser label =roleID value=desc / /html:select But it's giving me below given error.. No getter method available for property userID for bean under name userDataBean' But the userDataBean is having the getter method for the userID .. bye, prashant.. Nagendra Kumar O V S To: [EMAIL PROTECTED] [EMAIL PROTECTED]cc: go.com Subject: Re: html:select problem 08/11/03 06:27 PM Please respond to Struts Users Mailing List hi, u r not v clear in ur question is userBean, the action form associated with the jsp page..?? if yes. then html:select name=userDataBean property=user html:optionsCollection name=userDataBean property=roleUser label=roleid value=desc / /html:select should work for u the property user should also be in the action form, which holds the value of the client selected in the drop down on the form submit -- nagi ---Original Message--- From: Struts Users Mailing List Date: Monday, August 11, 2003 06:03:01 PM To: [EMAIL PROTECTED] Subject: ?XML:NAMESPACE PREFIX = HTML / problem Hi, I have a problem handling nested beans.. For example... I have a userBean as given below private int userID; private String lastName; private String firstName
Re: html:select multiple pre select
hi. docs say multiple="true" IS selected - The corresponding property should be an array of any supported data type. so try populating the array (html:select property) with the required elements to be selectedbefore hand. -- nagi ---Original Message--- From: Struts Users Mailing List Date: Thursday, July 31, 2003 05:02:03 PM To: Struts Users Mailing List Subject: html:select multiple pre select I have a html:select with multiple="true" how can I get this to have optionshighlighted when it loads? based on the elements already stored for thisselect field.ThanksDaniel Massie-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]. IncrediMail - Email has finally evolved - Click Here
RE: html:select multiple pre select
I've tried this, I passed in Strin[] as the value, but no options were selected. -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: 31 July 2003 12:50 To: [EMAIL PROTECTED] Subject: Re: html:select multiple pre select hi. docs say a.. multiple=true IS selected - The corresponding property should be an array of any supported data type. so try populating the array (html:select property) with the required elements to be selected before hand. -- nagi ---Original Message--- From: Struts Users Mailing List Date: Thursday, July 31, 2003 05:02:03 PM To: Struts Users Mailing List Subject: html:select multiple pre select I have a html:select with multiple=true how can I get this to have options highlighted when it loads? based on the elements already stored for this select field. Thanks Daniel Massie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . IncrediMail - Email has finally evolved - Click Here
RE: html:select multiple pre select
I've put together a set of Struts examples at http://www.ninsky.com/struts, one of which focuses on populating and options. struts-config.xml: form-bean name=optionsForm type=org.apache.struts.action.DynaActionForm form-property name=fruit3 type=java.lang.String[] initial=Banana Orange / /form-bean JSP: html:select property=fruit3 size=7 multiple=true html:option value=StrawberryStrawberry/html:option html:option value=AppleApple/html:option html:option value=OrangeOrange/html:option html:option value=PearPear/html:option html:option value=MangoMango/html:option html:option value=BananaBanana/html:option html:option value=PineapplePineapple/html:option /html:select Here, I've set initial values in the DynaActionForm configuration, but you could also initialise the values in your 'prepare' action. Steve -Original Message- From: Daniel Massie [mailto:[EMAIL PROTECTED] Sent: July 31, 2003 5:02 AM To: Struts Users Mailing List Subject: RE: html:select multiple pre select I've tried this, I passed in Strin[] as the value, but no options were selected. -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: 31 July 2003 12:50 To: [EMAIL PROTECTED] Subject: Re: html:select multiple pre select hi. docs say a.. multiple=true IS selected - The corresponding property should be an array of any supported data type. so try populating the array (html:select property) with the required elements to be selected before hand. -- nagi ---Original Message--- From: Struts Users Mailing List Date: Thursday, July 31, 2003 05:02:03 PM To: Struts Users Mailing List Subject: html:select multiple pre select I have a html:select with multiple=true how can I get this to have options highlighted when it loads? based on the elements already stored for this select field. Thanks Daniel Massie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] . IncrediMail - Email has finally evolved - Click Here - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select and data refresh
Hi, i guess u can try onchange event on select, to find out when the user selectes some thing and clear the result table displayed below for clearing the table u can use java script or will have to reload the page Ashish --- Rick Col [EMAIL PROTECTED] wrote: Hi, guys: I have a list for user to select, when user select one item from the list, and hit search button, a results table will be displayed at the bottom half of the page. Now, if user selects another item from the list, I want to refresh the table (or page?) and make the results table disappear before user hit search button again. I have no idea to do this. Can anyone give some thoughts on this? regards, rick __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - 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 http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select and data refresh
Thanks, Sorry for being naive on this. I am new to both javascript and struts. I am already using onchange to load data. Can I use another attribute, such as onblur, or onclick to do the job? And how do I reload the page to the previous page (that is: with no table display)? regards --- Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi, i guess u can try onchange event on select, to find out when the user selectes some thing and clear the result table displayed below for clearing the table u can use java script or will have to reload the page Ashish --- Rick Col [EMAIL PROTECTED] wrote: Hi, guys: I have a list for user to select, when user select one item from the list, and hit search button, a results table will be displayed at the bottom half of the page. Now, if user selects another item from the list, I want to refresh the table (or page?) and make the results table disappear before user hit search button again. I have no idea to do this. Can anyone give some thoughts on this? regards, rick __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - 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 http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select and data refresh
Rick, Check out using html frameset and frames. Have the result of your form go to a different results frame. Regards, Richard -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2003 12:04 PM To: Struts Users Mailing List Subject: Re: html:select and data refresh Thanks, Sorry for being naive on this. I am new to both javascript and struts. I am already using onchange to load data. Can I use another attribute, such as onblur, or onclick to do the job? And how do I reload the page to the previous page (that is: with no table display)? regards --- Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi, i guess u can try onchange event on select, to find out when the user selectes some thing and clear the result table displayed below for clearing the table u can use java script or will have to reload the page Ashish --- Rick Col [EMAIL PROTECTED] wrote: Hi, guys: I have a list for user to select, when user select one item from the list, and hit search button, a results table will be displayed at the bottom half of the page. Now, if user selects another item from the list, I want to refresh the table (or page?) and make the results table disappear before user hit search button again. I have no idea to do this. Can anyone give some thoughts on this? regards, rick __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - 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 http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.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]
Re: html:select and data refresh
Here is the thing u can try, onchange event check if the result table is displayed, if yes clear it first, and then load the new table Ashish --- Rick Col [EMAIL PROTECTED] wrote: Thanks, Sorry for being naive on this. I am new to both javascript and struts. I am already using onchange to load data. Can I use another attribute, such as onblur, or onclick to do the job? And how do I reload the page to the previous page (that is: with no table display)? regards --- Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi, i guess u can try onchange event on select, to find out when the user selectes some thing and clear the result table displayed below for clearing the table u can use java script or will have to reload the page Ashish --- Rick Col [EMAIL PROTECTED] wrote: Hi, guys: I have a list for user to select, when user select one item from the list, and hit search button, a results table will be displayed at the bottom half of the page. Now, if user selects another item from the list, I want to refresh the table (or page?) and make the results table disappear before user hit search button again. I have no idea to do this. Can anyone give some thoughts on this? regards, rick __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - 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 http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = A$HI$H __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select and data refresh
Thanks, Richard: The trouble is that I cannot use frameset in my design. So, it really gives me headache now :((. regards, --- Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote: Rick, Check out using html frameset and frames. Have the result of your form go to a different results frame. Regards, Richard -Original Message- From: Rick Col [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2003 12:04 PM To: Struts Users Mailing List Subject: Re: html:select and data refresh Thanks, Sorry for being naive on this. I am new to both javascript and struts. I am already using onchange to load data. Can I use another attribute, such as onblur, or onclick to do the job? And how do I reload the page to the previous page (that is: with no table display)? regards --- Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi, i guess u can try onchange event on select, to find out when the user selectes some thing and clear the result table displayed below for clearing the table u can use java script or will have to reload the page Ashish --- Rick Col [EMAIL PROTECTED] wrote: Hi, guys: I have a list for user to select, when user select one item from the list, and hit search button, a results table will be displayed at the bottom half of the page. Now, if user selects another item from the list, I want to refresh the table (or page?) and make the results table disappear before user hit search button again. I have no idea to do this. Can anyone give some thoughts on this? regards, rick __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - 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 http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.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] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select problem
hi, I tryed this way The selected items are not highlighted when the page is redisplayed ionel Prashanth.S wrote: Hi, I think that in the reset method in ur action form u need to make the selected array null[selected array is the array inside ur actionform that gets filled in request scope when u select any items in the list]so that the same array is not submitted again and again.. HTH Prashanth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select
Use the name attribute on html:select to refer to a bean which contains this property (as described by the property attribute). --- Sloan Seaman [EMAIL PROTECTED] wrote: If a user selects something from a html:select field and the next time the pages loads I want to get the value that they selected, how do I go about do this? I know that if I used html:option struts would select the correct option for me, but in my case the option tags get populated everytime by javascript so I need to get the selected option value from the bean that was set by struts... Thanks!! -- Sloan This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select tag
Take a look at the struts-example, there is a demonstration there. -- James Mitchell Software Developer/Struts Evangelist http://www.open-tools.org - Original Message - From: Shriyan Sanmuganathan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, May 29, 2003 12:59 PM Subject: html:select tag I'm new to Struts , can some one give me a good example of how to use html:select tag with options. Thanks Shriyan - 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 tag
Try this. http://bobcat.webappcabaret.net/ninsky/index.jsp I'd appreciate feedback if you find it useful (or not). Steve -Original Message- From: Shriyan Sanmuganathan [mailto:[EMAIL PROTECTED] Sent: May 29, 2003 9:59 AM To: [EMAIL PROTECTED] Subject: html:select tag I'm new to Struts , can some one give me a good example of how to use html:select tag with options. Thanks Shriyan - 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
What is the error you are getting. Your message shows you placing a variable in session scope, and then using a scriptlet to display a variable in request scope... Here is some code I find helpful to better debug these situations: Put this at the bottom of a jsp / footer: !-- if(com.whatever.Class.DEBUG_REQUEST) out.println(com.whatever.Class.getDumpContents(request); -- public static String getDumpContents(HttpServletRequest request) { StringBuffer content = new StringBuffer(4096); content.append(dumpRequest(request)); content.append(dumpSession(request.getSession(false))); return content.toString(); } public static String dumpSession(HttpSession session) { StringBuffer buf = new StringBuffer(1024); buf.append(*(HttpSession)**\n); // Append non-attribute data here Enumeration enum = session.getAttributeNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(session.getAttribute(key)); buf.append(\\n); } buf.append(\n\n); return buf.toString(); } public static String dumpRequest(HttpServletRequest request) { StringBuffer buf = new StringBuffer(1024); buf.append(*(HttpRequest)**\n); // Append non-attribute data here buf.append(\nAttributes:\n); Enumeration enum = request.getAttributeNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getAttribute(key)); buf.append(\\n); } buf.append(\nParameters:\n); enum = request.getParameterNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getParameter(key)); buf.append(\\n); } buf.append(\nHeaders:\n); enum = request.getHeaderNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getHeader(key)); buf.append(\\n); } buf.append(\n\n); return buf.toString(); } [EMAIL PROTECTED] wrote: Hi All, I am not able to get values in HTML:OPTIONS , I am adding values in my Session thru Controller , but not able to retrieve it in JSP form I put values in Session like this :- context.setAttribute(context.SESSION,OPTION,option); And try to retrieve values in JSP like this :- html:select property=status html:options collection=OPTION/ /html:select Am I doing something wrong , bcoz I am trying to figure this problem since long time , but no luck Can some body please tell me how to get values in HTML:OPTIONS when the values are added to Session thru Servlet. When I do this %System.out.println(request.getAttribute(OPTION)); % I can see all the values , but not with Struts tags Thanks in Advance Deepak This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately. Thank you. Aetna - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with [EMAIL PROTECTED] http://shopnow.netscape.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: HTML:SELECT
Hi Josh, I need to print all the values which I have added in the Session to be in my HTML:OPTIONS How can I do that ? Deepak -Original Message- From: Josh McCulloch [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 1:43 PM To: Struts Users Mailing List Subject: Re: HTML:SELECT What is the error you are getting. Your message shows you placing a variable in session scope, and then using a scriptlet to display a variable in request scope... Here is some code I find helpful to better debug these situations: Put this at the bottom of a jsp / footer: !-- if(com.whatever.Class.DEBUG_REQUEST) out.println(com.whatever.Class.getDumpContents(request); -- public static String getDumpContents(HttpServletRequest request) { StringBuffer content = new StringBuffer(4096); content.append(dumpRequest(request)); content.append(dumpSession(request.getSession(false))); return content.toString(); } public static String dumpSession(HttpSession session) { StringBuffer buf = new StringBuffer(1024); buf.append(*(HttpSession)**\n); // Append non-attribute data here Enumeration enum = session.getAttributeNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(session.getAttribute(key)); buf.append(\\n); } buf.append(\n\n); return buf.toString(); } public static String dumpRequest(HttpServletRequest request) { StringBuffer buf = new StringBuffer(1024); buf.append(*(HttpRequest)**\n); // Append non-attribute data here buf.append(\nAttributes:\n); Enumeration enum = request.getAttributeNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getAttribute(key)); buf.append(\\n); } buf.append(\nParameters:\n); enum = request.getParameterNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getParameter(key)); buf.append(\\n); } buf.append(\nHeaders:\n); enum = request.getHeaderNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getHeader(key)); buf.append(\\n); } buf.append(\n\n); return buf.toString(); } [EMAIL PROTECTED] wrote: Hi All, I am not able to get values in HTML:OPTIONS , I am adding values in my Session thru Controller , but not able to retrieve it in JSP form I put values in Session like this :- context.setAttribute(context.SESSION,OPTION,option); And try to retrieve values in JSP like this :- html:select property=status html:options collection=OPTION/ /html:select Am I doing something wrong , bcoz I am trying to figure this problem since long time , but no luck Can some body please tell me how to get values in HTML:OPTIONS when the values are added to Session thru Servlet. When I do this %System.out.println(request.getAttribute(OPTION)); % I can see all the values , but not with Struts tags Thanks in Advance Deepak This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately. Thank you. Aetna - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with [EMAIL PROTECTED] http://shopnow.netscape.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately. Thank you. Aetna - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTML:SELECT
Give the code I gave you a shot. Then view the page source, and at the bottom of the page will be a dump of the http request (and session). This lets you view what variable names / keys are available in the different scopes, and with Collections, should output [val1, val2, val3]. This is VERY helpful for debugging, it beats %= request.getAttribute(XXX) % What type of variable is OPTION. Is it a Collection, Map, Array? Is it in session or request scope? What is the error you are getting (if any?). If page is loaded, what HTML source is displayed when you view source around the select in question? Check and see if there is a OPTION variable in multiple variable scopes. I'm not sure of the precedence order, but maybe a request/session scope variable exist, one of which is empty? - Josh [EMAIL PROTECTED] wrote: Hi Josh, I need to print all the values which I have added in the Session to be in my HTML:OPTIONS How can I do that ? Deepak -Original Message- From: Josh McCulloch [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 1:43 PM To: Struts Users Mailing List Subject: Re: HTML:SELECT What is the error you are getting. Your message shows you placing a variable in session scope, and then using a scriptlet to display a variable in request scope... Here is some code I find helpful to better debug these situations: Put this at the bottom of a jsp / footer: !-- if(com.whatever.Class.DEBUG_REQUEST) out.println(com.whatever.Class.getDumpContents(request); -- public static String getDumpContents(HttpServletRequest request) { StringBuffer content = new StringBuffer(4096); content.append(dumpRequest(request)); content.append(dumpSession(request.getSession(false))); return content.toString(); } public static String dumpSession(HttpSession session) { StringBuffer buf = new StringBuffer(1024); buf.append(*(HttpSession)**\n); // Append non-attribute data here Enumeration enum = session.getAttributeNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(session.getAttribute(key)); buf.append(\\n); } buf.append(\n\n); return buf.toString(); } public static String dumpRequest(HttpServletRequest request) { StringBuffer buf = new StringBuffer(1024); buf.append(*(HttpRequest)**\n); // Append non-attribute data here buf.append(\nAttributes:\n); Enumeration enum = request.getAttributeNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getAttribute(key)); buf.append(\\n); } buf.append(\nParameters:\n); enum = request.getParameterNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getParameter(key)); buf.append(\\n); } buf.append(\nHeaders:\n); enum = request.getHeaderNames(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); buf.append(key); buf.append(=\); buf.append(request.getHeader(key)); buf.append(\\n); } buf.append(\n\n); return buf.toString(); } [EMAIL PROTECTED] wrote: Hi All, I am not able to get values in HTML:OPTIONS , I am adding values in my Session thru Controller , but not able to retrieve it in JSP form I put values in Session like this :- context.setAttribute(context.SESSION,OPTION,option); And try to retrieve values in JSP like this :- html:select property=status html:options collection=OPTION/ /html:select Am I doing something wrong , bcoz I am trying to figure this problem since long time , but no luck Can some body please tell me how to get values in HTML:OPTIONS when the values are added to Session thru Servlet. When I do this %System.out.println(request.getAttribute(OPTION)); % I can see all the values , but not with Struts tags Thanks in Advance Deepak This e-mail may contain confidential or privileged information. If you think you have received this e-mail in error, please advise the sender by reply e-mail and then delete this e-mail immediately. Thank you. Aetna - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with [EMAIL PROTECTED] http://shopnow.netscape.com/
RE: html:select tag
your link explains very detail. if i have 15 drop downs on a page means i need to give 15 different request.setAttributes PrepareOptionsAction has so many request.setAttribute things. is any better way doing this with html:options. Sri -Original Message- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 12:05 PM To: Struts Users Mailing List Subject: RE: html:select tag Try this. http://bobcat.webappcabaret.net/ninsky/index.jsp I'd appreciate feedback if you find it useful (or not). Steve -Original Message- From: Shriyan Sanmuganathan [mailto:[EMAIL PROTECTED] Sent: May 29, 2003 9:59 AM To: [EMAIL PROTECTED] Subject: html:select tag I'm new to Struts , can some one give me a good example of how to use html:select tag with options. Thanks Shriyan - 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 tag
If you have 15 *different* lists then, yes, you will need to store them all. But if 2 or more lists share the same options then you will only need one collection. On the example page, there are two lists of books, but they both get their options from the same request scope collection. Also, you might not need to place your collections in the request each time. Depending on the list, you might be able to use the session or application scopes. For example, a list that all users share and does not change could be placed in the application scope at application startup. Steve -Original Message- From: Kommana, Sridhar [mailto:[EMAIL PROTECTED] Sent: May 29, 2003 1:53 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: html:select tag your link explains very detail. if i have 15 drop downs on a page means i need to give 15 different request.setAttributes PrepareOptionsAction has so many request.setAttribute things. is any better way doing this with html:options. Sri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select / html:options
That means we are keeping unsafeValues and unsafeLabels separately in our form-bean. (Though they are related -- i think so) What if these two are kept encapsulated in an object. -Original Message- From: Kandi Potter [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2003 9:06 PM To: Struts Users Mailing List Subject: RE: html:select / html:options I used the following with vectors of unsafeValues and unsafeLabels in my incidentForm bean. html:select name=incidentForm property=selectedUnsafe html:option value=nbsp/html:option html:options name=incidentForm property=unsafeValues labelName=incidentForm labelProperty=unsafeLabels / /html:select/TD -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2003 11:20 AM To: Struts Users Mailing List Subject: html:select / html:options I have a vector of Objects of a class whose attributes are ID and Name. This vector is set in the form bean. I want to display that vector as a select/options field. ID part will form the value and Name the displayable option. How can this be done. Thanx a lot. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Message from InterScan E-Mail VirusWall NT ** ** No virus found in attached file noname.htm No Virus detected in the attached file(s). * End of message *** This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select / html:options
use optionsCollection tag property: name of the collection in the form Bean label : The property of the bean within the collection which represents the label to be rendered for each option. (ie. Name) value: The property of the bean within the collection which represents the value to be rendered for each option. (ie ID) thus: html:optionsCollection property=propertyOfFormBeanContainingCollection label=name value=id / Abhinav (Cognizant) wrote: That means we are keeping unsafeValues and unsafeLabels separately in our form-bean. (Though they are related -- i think so) What if these two are kept encapsulated in an object. -Original Message- From: Kandi Potter [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2003 9:06 PM To: Struts Users Mailing List Subject: RE: html:select / html:options I used the following with vectors of unsafeValues and unsafeLabels in my incidentForm bean. html:select name=incidentForm property=selectedUnsafe html:option value=nbsp/html:option html:options name=incidentForm property=unsafeValues labelName=incidentForm labelProperty=unsafeLabels / /html:select/TD -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2003 11:20 AM To: Struts Users Mailing List Subject: html:select / html:options I have a vector of Objects of a class whose attributes are ID and Name. This vector is set in the form bean. I want to display that vector as a select/options field. ID part will form the value and Name the displayable option. How can this be done. Thanx a lot. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** Message from InterScan E-Mail VirusWall NT ** ** No virus found in attached file noname.htm No Virus detected in the attached file(s). * End of message *** This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.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]
RE: html:select / html:options
I'm just learning here as well.but that is what worked for me. I actually store the vectors in a CollectionForm with the two vectors as members. I don't know if this was the most graceful way to handle the problem, but it worked for me. I have something like this: I used a CollectionForm for the same purpose as you would like to. I have several drop-down selections so I just create a CollectionForm object for each, and populate the labels and values from my business object, which I'm sure you have done already. also, for state management, the collectionForms are stored in a transaction to be re-used during the same session. This way I can grab them for any action where I need the same drop-down list. public class CollectionForm implements Serializable { private Vector labels; private Vector values; ... public class IncidentForm extends ActionForm implements Serializable { public Vector getUnsafeLabels(){ return CollectionForm.getLabels(); } public Vector getUnsafeValues(){ return CollectionForm.getValues(); } ... -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2003 11:49 AM To: Struts Users Mailing List Subject: RE: html:select / html:options That means we are keeping unsafeValues and unsafeLabels separately in our form-bean. (Though they are related -- i think so) What if these two are kept encapsulated in an object. -Original Message- From: Kandi Potter [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2003 9:06 PM To: Struts Users Mailing List Subject: RE: html:select / html:options I used the following with vectors of unsafeValues and unsafeLabels in my incidentForm bean. html:select name=incidentForm property=selectedUnsafe html:option value=nbsp/html:option html:options name=incidentForm property=unsafeValues labelName=incidentForm labelProperty=unsafeLabels / /html:select/TD -Original Message- From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 27, 2003 11:20 AM To: Struts Users Mailing List Subject: html:select / html:options I have a vector of Objects of a class whose attributes are ID and Name. This vector is set in the form bean. I want to display that vector as a select/options field. ID part will form the value and Name the displayable option. How can this be done. Thanx 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
Use the value attribute on the html:select tag. -Original Message- From: Jesse Vitrone [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2003 1:47 PM To: [EMAIL PROTECTED] Subject:html:select I'm pretty new to the jsp tag stuff, and I need to do something that I would think is pretty common, but I can't seem to do it without resorting to scriptlets. I have an Address, which has a String state on it. I have a Collection of States which have an int id, and String name on them. How can I generate a select list that defaults to the value that matches the state on my Address? Seems like this would be pretty common, but I can't find it anywhere :( Thanks in advance, Jesse - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select multiple=true not working...
You can't use String[] inside a Map backed field. The value will get overwritten by the next property of the same name in the map. Use a String[] to support multi valued select boxes. David From: WILLIAMS,RAND (HP-USA,ex1) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: html:select multiple=true not working... Date: Wed, 19 Mar 2003 10:08:00 -0800 Anyone tried this? Using a map backed form, where set(key,val) { mymap.put(key,val) } and get(key) { return mymap.get(key) } I am having a problem with String[] and multiple attribute of html:select: html:select property=value(selectProduct) multiple=true logic:iterate id=x name=telecomModel property=services bean:define id=y name=x property=product / html:option value='%=(String)y%' / /logic:iterate /html:select Even though value(selectProduct) gives to the tag [INFO] SmModelForm - - getValue(selectProduct) = [Ljava.lang.String;@deb5f which is a String[0] The problem i see is beanUtils still populates the field with only a string: [INFO] SmModelForm - - setValue(selectProduct,U3995) which is merely a String - not a String[] with an element (String) U3995. Is there something wrong or am I missing something here?? Is there an issue with retrieving or setting the String[] from a HashMap? Thanks in advance for help :) -Rand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select multiple=true not working... how does it work?
Hi David, thank you :) But I'm still a bit confused. The reason why I want to use a Map to hold these values of the form, is that I want the flexibility of having X number of String[], populated from the form :selects and stored in the Map. Then I can process X String[]'s in my Action by iterating over the Map, and doing the appropriate stuff with the Map.Entry Key (String), and Map.Entry Value (the String[]). I don't understand, because it works for everything else, including other bean objects... just not for a String[] for a String, there is no problem, for property=value(myString) beanUtils finds and does my getValue(myString) and the object returned is a String. for a String[], there is a problem, for property=value(myArray) beanUtils finds and does my getValue(myArray) and the object returned is a String[0], or null. Is the problem that it is [0] or null? Are you saying is that it is overwritten by the beanUtils use of my setValue(myArray, String[])? Or is beanUtils using setValue(myArray, String)? Or does beanUtils find that the returned object, although it is a String[], is zero size - it creates another String[_numberOfSelections] and then uses my setValue(myArray, the new String[]) but that latter seems like it would work... Or is it that since beanUtils cannot find an indexed setValue(key, value, idx), it doesn't even bother with trying to populate my String[] (through the indexed set()) and just opt's to set the first value of my selection (String[0]) by simply doing setValue(myArray, String[0])? This is what it looks like it does... Just trying to understand it... what do you think?? THANKS! -Rand -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 1:41 PM To: [EMAIL PROTECTED] Subject: Re: html:select multiple=true not working... You can't use String[] inside a Map backed field. The value will get overwritten by the next property of the same name in the map. Use a String[] to support multi valued select boxes. David From: WILLIAMS,RAND (HP-USA,ex1) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: html:select multiple=true not working... Date: Wed, 19 Mar 2003 10:08:00 -0800 Anyone tried this? Using a map backed form, where set(key,val) { mymap.put(key,val) } and get(key) { return mymap.get(key) } I am having a problem with String[] and multiple attribute of html:select: html:select property=value(selectProduct) multiple=true logic:iterate id=x name=telecomModel property=services bean:define id=y name=x property=product / html:option value='%=(String)y%' / /logic:iterate /html:select Even though value(selectProduct) gives to the tag [INFO] SmModelForm - - getValue(selectProduct) = [Ljava.lang.String;@deb5f which is a String[0] The problem i see is beanUtils still populates the field with only a string: [INFO] SmModelForm - - setValue(selectProduct,U3995) which is merely a String - not a String[] with an element (String) U3995. Is there something wrong or am I missing something here?? Is there an issue with retrieving or setting the String[] from a HashMap? Thanks in advance for help :) -Rand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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 multiple=true not working... how does it work?
Say you have 2 input fields backed by a Map named myMap: input type=text name=myMap(one) value=1/ input type=text name=myMap(one) value=2/ When the form is populated the Map value for key one will get written twice and the last one entered will be your value. David From: WILLIAMS,RAND (HP-USA,ex1) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: html:select multiple=true not working... how does it work? Date: Wed, 19 Mar 2003 14:04:27 -0500 Hi David, thank you :) But I'm still a bit confused. The reason why I want to use a Map to hold these values of the form, is that I want the flexibility of having X number of String[], populated from the form :selects and stored in the Map. Then I can process X String[]'s in my Action by iterating over the Map, and doing the appropriate stuff with the Map.Entry Key (String), and Map.Entry Value (the String[]). I don't understand, because it works for everything else, including other bean objects... just not for a String[] for a String, there is no problem, for property=value(myString) beanUtils finds and does my getValue(myString) and the object returned is a String. for a String[], there is a problem, for property=value(myArray) beanUtils finds and does my getValue(myArray) and the object returned is a String[0], or null. Is the problem that it is [0] or null? Are you saying is that it is overwritten by the beanUtils use of my setValue(myArray, String[])? Or is beanUtils using setValue(myArray, String)? Or does beanUtils find that the returned object, although it is a String[], is zero size - it creates another String[_numberOfSelections] and then uses my setValue(myArray, the new String[]) but that latter seems like it would work... Or is it that since beanUtils cannot find an indexed setValue(key, value, idx), it doesn't even bother with trying to populate my String[] (through the indexed set()) and just opt's to set the first value of my selection (String[0]) by simply doing setValue(myArray, String[0])? This is what it looks like it does... Just trying to understand it... what do you think?? THANKS! -Rand -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 19, 2003 1:41 PM To: [EMAIL PROTECTED] Subject: Re: html:select multiple=true not working... You can't use String[] inside a Map backed field. The value will get overwritten by the next property of the same name in the map. Use a String[] to support multi valued select boxes. David From: WILLIAMS,RAND (HP-USA,ex1) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: html:select multiple=true not working... Date: Wed, 19 Mar 2003 10:08:00 -0800 Anyone tried this? Using a map backed form, where set(key,val) { mymap.put(key,val) } and get(key) { return mymap.get(key) } I am having a problem with String[] and multiple attribute of html:select: html:select property=value(selectProduct) multiple=true logic:iterate id=x name=telecomModel property=services bean:define id=y name=x property=product / html:option value='%=(String)y%' / /logic:iterate /html:select Even though value(selectProduct) gives to the tag [INFO] SmModelForm - - getValue(selectProduct) = [Ljava.lang.String;@deb5f which is a String[0] The problem i see is beanUtils still populates the field with only a string: [INFO] SmModelForm - - setValue(selectProduct,U3995) which is merely a String - not a String[] with an element (String) U3995. Is there something wrong or am I missing something here?? Is there an issue with retrieving or setting the String[] from a HashMap? Thanks in advance for help :) -Rand - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select multiple problems
The example referenced by Jörg Maurer is available in Struts 1.0.2 as well. It includes the following tr th align=rightMultiple Select Allowed:/th td align=left html:select property=multipleSelect size=10 multiple=true html:options name=multipleValues labelName=multipleValues/ /html:select /td /tr which is identical to what you are trying to accomplish. As you are probably aware, the property multipleSelect here (ids in your case) holds the selected values while multipleValues is the collection of available options. However the snippet you have sent in one of your emails has html:select property=ids multiple=true html:options property=ids/ /html:select Looking at your form bean definition I think what you are trying to do is display Zero, One but have the values 0 and 1 submitted. What you have to do is to set up LabelValueBeans with the necessary name and value. I *think* LabelValueBeans are part of Struts 1.0.2; if not simply create a JavaBean with name and value properties and make a collection of them. Look at the docs for html:options on how to use it. Also, ensure that your html:select is inside a html:form Sri -Original Message- From: Ian Hunter [mailto:[EMAIL PROTECTED] Sent: Sunday, February 23, 2003 11:03 PM To: Struts Users Mailing List Subject: Re: html:select multiple problems OK. Let me narrow down my question somewhat. In Struts 1.0.2, what method in an ActionForm is called after an input JSP containing an html:select multiple=true property=ids tag, assuming the property ids is a String[]? Does it look like public void setIds(Object[] ids) or public void setIds(String[] ids) or public void setIds(ArrayList ids) or what? Seems like no matter what setter method I provide, it doesn't get called. - Original Message - From: Ian Hunter [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, February 23, 2003 9:20 PM Subject: html:select multiple problems RGH I would give one of my legs right now for a working example of an html:select multiple=true usage that populates an array in an ActionForm. Help? - 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 multiple problems
So I have to create Collection-type classes to hold the values so that the select tag can populate them? That doesn't make sense, when with a non-multiple select I can just refer to a single String property. I looked at the example and I still don't have an answer to my original question: What method(s) in the ActionForm class get called to set the values from a multiple select box, if the JSP looks like this: html:form name=attendanceForm action=postattendance type=AttendanceForm html:select property=ids html:option value=0Zero/html:option html:option value=1One/html:option html:option value=2Two/html:option /html:select /html:form Surely html:select can handle hard coded options? I just can't figure out which setter method profile would get called here, and the example code (TestBean.java) has SO many different getter/setter things going on that I can't figure which goes with what from the JSP. - Original Message - From: Sri Sankaran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 24, 2003 9:44 AM Subject: RE: html:select multiple problems The example referenced by Jörg Maurer is available in Struts 1.0.2 as well. It includes the following tr th align=rightMultiple Select Allowed:/th td align=left html:select property=multipleSelect size=10 multiple=true html:options name=multipleValues labelName=multipleValues/ /html:select /td /tr which is identical to what you are trying to accomplish. As you are probably aware, the property multipleSelect here (ids in your case) holds the selected values while multipleValues is the collection of available options. However the snippet you have sent in one of your emails has html:select property=ids multiple=true html:options property=ids/ /html:select Looking at your form bean definition I think what you are trying to do is display Zero, One but have the values 0 and 1 submitted. What you have to do is to set up LabelValueBeans with the necessary name and value. I *think* LabelValueBeans are part of Struts 1.0.2; if not simply create a JavaBean with name and value properties and make a collection of them. Look at the docs for html:options on how to use it. Also, ensure that your html:select is inside a html:form Sri -Original Message- From: Ian Hunter [mailto:[EMAIL PROTECTED] Sent: Sunday, February 23, 2003 11:03 PM To: Struts Users Mailing List Subject: Re: html:select multiple problems OK. Let me narrow down my question somewhat. In Struts 1.0.2, what method in an ActionForm is called after an input JSP containing an html:select multiple=true property=ids tag, assuming the property ids is a String[]? Does it look like public void setIds(Object[] ids) or public void setIds(String[] ids) or public void setIds(ArrayList ids) or what? Seems like no matter what setter method I provide, it doesn't get called. - Original Message - From: Ian Hunter [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, February 23, 2003 9:20 PM Subject: html:select multiple problems RGH I would give one of my legs right now for a working example of an html:select multiple=true usage that populates an array in an ActionForm. Help? - 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 multiple problems
While messing around with things a minute ago, I found that the only setter method in my ActionForm that gets called is public void setIds (String[] ids), but when it does get called I get the following error: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:20 61) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) ... root cause: java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:98 8) at org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:90 4) at org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932) at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:509) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:772) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:20 61) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) So it must not like the String[] part. However, I already HAVE the following methods defined but they don't get run: public void setIds (java.util.ArrayList ids) public void setIds (Object[] ids) public void setIds (int i, String id) public void setIds (int i, Object id) If I comment out setIds(String[] ids) completely, it runs right through but never populates the ids field. I guess it assumes that's a read only field. What signature is it looking for in the setIds method if not String[]? - Original Message - From: Ian Hunter [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 24, 2003 10:20 AM Subject: Re: html:select multiple problems So I have to create Collection-type classes to hold the values so that the select tag can populate them? That doesn't make sense, when with a non-multiple select I can just refer to a single String property. I looked at the example and I still don't have an answer to my original question: What method(s) in the ActionForm class get called to set the values from a multiple select box, if the JSP looks like this: html:form name=attendanceForm action=postattendance type=AttendanceForm html:select property=ids html:option value=0Zero/html:option html:option value=1One/html:option html:option value=2Two/html:option /html:select /html:form Surely html:select can handle hard coded options? I just can't figure out which setter method profile would get called here, and the example code (TestBean.java) has SO many different getter/setter things going on that I can't figure which goes with what from the JSP. - Original Message - From: Sri Sankaran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 24, 2003 9:44 AM Subject: RE: html:select multiple problems The example referenced by Jörg Maurer is available in Struts 1.0.2 as well. It includes the following tr th align=rightMultiple Select Allowed:/th td align=left html:select property=multipleSelect size=10 multiple=true html:options name=multipleValues labelName=multipleValues/ /html:select /td /tr which is identical to what you are trying to accomplish. As you are probably aware, the property multipleSelect here (ids in your case) holds the selected values while multipleValues is the collection of available options. However the snippet you have sent in one of your emails has html:select property=ids multiple=true html:options property=ids/ /html:select Looking at your form bean definition I think what you are trying to do is display Zero, One but have the values 0 and 1 submitted. What you have to do is to set up LabelValueBeans with the necessary name and value. I *think* LabelValueBeans are part of Struts 1.0.2; if not simply create a JavaBean with name and value properties and make a collection of them. Look at the docs for html:options on how to use it. Also, ensure that your html:select is inside a html:form Sri -Original Message- From: Ian Hunter [mailto:[EMAIL PROTECTED] Sent: Sunday, February 23, 2003 11:03 PM To: Struts Users Mailing List Subject: Re: html:select
RE: html:select multiple problems
So I have to create Collection-type classes to hold the values so that the select tag can populate them? That doesn't make sense, when with a non-multiple select I can just refer to a single String property. First let me explain the need for a LabelValueBean. I will then tell you why (it looks like) you don't need them. Typically, each option in a selection list requires a pair of values. One to display (a.k.a.. the label) -- Zero, One, etc, in your case -- and one that is the actual (codified) value -- 0, 1, etc in your case. How can to achieve this with a scalar? Hence the need for a LabelValueBean. For example: new LabelValueBean(Zero, 0) You'd build your collection will a bunch of such LabelValueBeans. Then your html:options would look like html:options collection=theCollectionOfLabelValueBeans labelProperty=label property=value/ You can step around creating LabelValueBeans if you don't need to hide the actual value that is submitted. In other words if you want the users to see 0, 1, etc instead of Zero, One, etc. In fact, that is what you see in the example application. I looked at the example and I still don't have an answer to my original question: What method(s) in the ActionForm class get called to set the values from a multiple select box, if the JSP looks like this: html:form name=attendanceForm action=postattendance type=AttendanceForm html:select property=ids html:option value=0Zero/html:option html:option value=1One/html:option html:option value=2Two/html:option /html:select /html:form Surely html:select can handle hard coded options? I just can't figure out which setter method profile would get called here, The value being set is the collection of ids, so Struts will look for a setIds. and the example code (TestBean.java) has SO many different getter/setter things going on that I can't figure which goes with what from the JSP. While testing I have found it useful to create a new application (using struts-blank) and use the code from struts exercises as a starting point. For example, take the html-select.jsp and remove everything except the case in which you are interested. Similarly edit TestBean. Hope that helps Sri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select multiple problems
It's working perfectly now. I don't know for sure what fixed it; I compared the example code to mine, started pulling stuff OUT of my class, Tomcat / Sun ONE Studio started acting funny, so I closed everything, blew away the Tomcat /work directory, tried again, and *poof* no more errors. I think I had something cached that was screwing me up. Thanks for all the input... - Original Message - From: Sri Sankaran [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 24, 2003 10:52 AM Subject: RE: html:select multiple problems So I have to create Collection-type classes to hold the values so that the select tag can populate them? That doesn't make sense, when with a non-multiple select I can just refer to a single String property. First let me explain the need for a LabelValueBean. I will then tell you why (it looks like) you don't need them. Typically, each option in a selection list requires a pair of values. One to display (a.k.a.. the label) -- Zero, One, etc, in your case -- and one that is the actual (codified) value -- 0, 1, etc in your case. How can to achieve this with a scalar? Hence the need for a LabelValueBean. For example: new LabelValueBean(Zero, 0) You'd build your collection will a bunch of such LabelValueBeans. Then your html:options would look like html:options collection=theCollectionOfLabelValueBeans labelProperty=label property=value/ You can step around creating LabelValueBeans if you don't need to hide the actual value that is submitted. In other words if you want the users to see 0, 1, etc instead of Zero, One, etc. In fact, that is what you see in the example application. I looked at the example and I still don't have an answer to my original question: What method(s) in the ActionForm class get called to set the values from a multiple select box, if the JSP looks like this: html:form name=attendanceForm action=postattendance type=AttendanceForm html:select property=ids html:option value=0Zero/html:option html:option value=1One/html:option html:option value=2Two/html:option /html:select /html:form Surely html:select can handle hard coded options? I just can't figure out which setter method profile would get called here, The value being set is the collection of ids, so Struts will look for a setIds. and the example code (TestBean.java) has SO many different getter/setter things going on that I can't figure which goes with what from the JSP. While testing I have found it useful to create a new application (using struts-blank) and use the code from struts exercises as a starting point. For example, take the html-select.jsp and remove everything except the case in which you are interested. Similarly edit TestBean. Hope that helps Sri - 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] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems)
Ah-HAH! I was adding back in some other methods and broke it again, but I think I get it. My setter method is called public void setIds (String ids[]) -- when I created a method called public void setIds(int i, String ids) that killed it because BeanUtils.populate was calling the wrong setter method. What is the correct convention for creating getter/setting methods for accessing individual entries within an Array when you ALSO have getter/setters that handle the array as a whole? I thought I had it right -- I thought you overloaded the array methods and stuck an index in. - Original Message - From: Ian Hunter [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 24, 2003 11:57 AM Subject: Re: html:select multiple problems It's working perfectly now. I don't know for sure what fixed it; I compared the example code to mine, started pulling stuff OUT of my class, Tomcat / Sun ONE Studio started acting funny, so I closed everything, blew away the Tomcat /work directory, tried again, and *poof* no more errors. I think I had something cached that was screwing me up. Thanks for all the input... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems)
-Original Message- From: Ian Hunter [mailto:[EMAIL PROTECTED] My setter method is called public void setIds (String ids[]) -- when I created a method called public void setIds(int i, String ids) that killed it because BeanUtils.populate was calling the wrong setter method. Call it public void setId(int i, String ids) instead, and you should be all set. The JavaBeans specification allows there to be an indexed setter for an array property. Indexed setters operate on a single instance of the array type. So, to sum up, you should have: public String[] getIds(); public void setIds(String[] ids); public void setId(int i, String id); Laird - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems)
DO NOT NEVER EVER OVERLOAD METHOD NAMES of JAVA BEANS. NEVER. I swear to you, i was going mad about this 2 weeks ago. Sorry I didn´t catch your problem earlier. My experience - INTROSPECTION DONE BY STRUTS CANT DISTINCT on METHOD parameters - JUST BY METHOD NAME! First come, first serve - or sth. like that. I always use sth. like this in Action Forms - DENOTE PLURAL vs. SINGULAR : protected Hashtable[] chooseParams = new Hashtable[200]; ... public Hashtable[] getChooseParams() { return this.chooseParams; } public Hashtable getChooseParam(int index) { return (Hashtable)this.chooseParams[index]; } public void setChooseParam(int index, Hashtable chooseParams) { this.chooseParams[index] = chooseParams; } public void setChooseParams(Hashtable[] eventUpdateParams) { this.chooseParams = chooseParams; } -Original Message- From: Ian Hunter [mailto:[EMAIL PROTECTED] Sent: Montag, 24. Februar 2003 18:12 To: Struts Users Mailing List Subject: [OT] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems) Ah-HAH! I was adding back in some other methods and broke it again, but I think I get it. My setter method is called public void setIds (String ids[]) -- when I created a method called public void setIds(int i, String ids) that killed it because BeanUtils.populate was calling the wrong setter method. What is the correct convention for creating getter/setting methods for accessing individual entries within an Array when you ALSO have getter/setters that handle the array as a whole? I thought I had it right -- I thought you overloaded the array methods and stuck an index in. - Original Message - From: Ian Hunter [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 24, 2003 11:57 AM Subject: Re: html:select multiple problems It's working perfectly now. I don't know for sure what fixed it; I compared the example code to mine, started pulling stuff OUT of my class, Tomcat / Sun ONE Studio started acting funny, so I closed everything, blew away the Tomcat /work directory, tried again, and *poof* no more errors. I think I had something cached that was screwing me up. Thanks for all the input... - 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: [Unverified Sender] RE: [OT] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems)
-Original Message- From: Nelson, Laird [mailto:[EMAIL PROTECTED] So, to sum up, you should have: public String[] getIds(); public void setIds(String[] ids); public void setId(int i, String id); ...and public String getId(int i); Laird - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Unverified Sender] RE: [OT] (Slightly OT) Accessing individ ual array elements (was Re: html:select multiple problems)
You shouldn't drop the s. You should have: public String[] getIds() public void setIds(String[] ids) public String getIds(int i) public void setIds(int i, String id) See: http://java.sun.com/products/javabeans/docs/spec.html (Section 7.2) http://java.sun.com/docs/books/tutorial/javabeans/properties/indexed.html Although, I'm not really sure if Struts makes use of the indexed methods... Quoting Nelson, Laird [EMAIL PROTECTED]: -Original Message- From: Nelson, Laird [mailto:[EMAIL PROTECTED] So, to sum up, you should have: public String[] getIds(); public void setIds(String[] ids); public void setId(int i, String id); ...and public String getId(int i); Laird - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Unverified Sender] RE: [OT] (Slightly OT) Accessing individ ual array elements (was Re: html:select multiple problems)
-Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] You shouldn't drop the s. How right you are. Teach me to post based off (incorrect) memory. :-( Laird - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems)
Thanks! - Original Message - From: Nelson, Laird [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Monday, February 24, 2003 12:21 PM Subject: RE: [OT] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems) Call it public void setId(int i, String ids) instead, and you should be all set. The JavaBeans specification allows there to be an indexed setter for an array property. Indexed setters operate on a single instance of the array type. So, to sum up, you should have: public String[] getIds(); public void setIds(String[] ids); public void setId(int i, String id); Laird - 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] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems)
Thanks! - Original Message - From: Jörg Maurer [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, February 24, 2003 12:22 PM Subject: RE: [OT] (Slightly OT) Accessing individual array elements (was Re: html:select multiple problems) DO NOT NEVER EVER OVERLOAD METHOD NAMES of JAVA BEANS. NEVER. I swear to you, i was going mad about this 2 weeks ago. Sorry I didn´t catch your problem earlier. My experience - INTROSPECTION DONE BY STRUTS CANT DISTINCT on METHOD parameters - JUST BY METHOD NAME! First come, first serve - or sth. like that. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:select multiple problems
I will choose your left leg cause i am a kind man and hint you to the your_jakarta-struts-1.1-b3-src_dir\web\exercise-taglib\html-select.jsp. -Original Message- From: Ian Hunter [mailto:[EMAIL PROTECTED] Sent: Montag, 24. Februar 2003 03:20 To: Struts Users Mailing List Subject: html:select multiple problems RGH I would give one of my legs right now for a working example of an html:select multiple=true usage that populates an array in an ActionForm. Help? - 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]