HTML:Select

Hi,
I am having a list of names from DB which I should show in the muliselect box. I have a form bean which has a String array with the names to be shown.
I have written like this...but dont know if im correct
<html:select name="nameForm" property="nameList"  multiple="true">
<html:options collection="nameList" property="name" labelProperty="name"/>
</html:select>                    Now my question is in html select should the attribute property also point to the name of the arraylist. and collection should also point to arralist?
How it should be written...can you please help...
Thanks

In form bean I have
String[] namesList;
public String[] getNamesList(){
xxxxxx ;
public setNamesList(){
xxx;
}in this case the property is also namesList and collections should also point to the list which is namesList. Is this correct?

Similar Messages

  • The html select box option is not getting displayed properly in IE11

    The html select box option is not getting displayed properly in IE11
    I have developed a website that has a select box drop down. The select box drop down is getting displayed properly in IE9. But in IE11, if I am selecting any option apart from the first one, the whole select box option is getting moved up in the page.
    In IE11, if option 2 is selected, then the select options is getting moved up. But in IE9, if option 2 is selected, then the select options is getting displayed properly.
    Please let me know the fix so that the select options are displayed in the same manner as in IE9.
    Sorry but I am unable to upload images as this site is throwing some error

    Hi Kevin Shen,
    Thanks for post.
    I tried above code in ie 11(version 11.0.9600.17633).
    But it is not working. If you select option 2, and open select box then it open on the select box.
    It should open below the select box.
    Code for above:-
    <select>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    </select>
    Sorry I could not attach screen shot. We have normal select box with three options. If we select option 2, it is showing option list on the select box. It is coming below the select box in ie 10 and other browse like chrome. 
    So what we should do, so that all options will come below the select box?
    Thanks,
    Yogesh Toke

  • How to get the values from html:select? tag..?

    i tried with this, but its not working...
    <html:select styleClass="text" name="querydefs" property="shortcut"
                 onchange="retrieveOptions()" styleId="firstBox" indexed="true">
    <html:options collection="advanced.choices" property="shortcut" labelProperty="label" />
    </html:select>
                        <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>

    <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>This java script is not working at all..its not printing anything in document.write();
    This is code..
    <td class="rowcolor1" width="20%">
    <html:select styleClass="text" name="querydefs" property="shortcut"
                             onchange="retrieveSecondOptions()" styleId="firstBox"
                             indexed="true">
                             <html:options collection="advanced.choices" property="shortcut"
                                  labelProperty="label"  />
                        </html:select>i tried with this also. but no use..i'm not the getting the seleced option...
    function retrieveOptions(){
    firstBox = document.getElementById('firstBox');
                             if(firstBox.selectedIndex==0){
          return;
        selectedOption = firstBox.options[firstBox.selectedIndex].value;
    }actually , how to get the values from <html:select> ...?
    my idea is to know which value is selected from the combo box(<html:select> ) if that value is equal some string i have enable a hyperlink to open a popup window

  • Problem with html:select or html:options tags using struts,jsp and tomcat

    Hi
    I'm updating a Struts-Project to a new layout and therefore rework all jsp Sites.
    I'm also using a new Folder-Structure and update therefore my struts-config file.
    My Problem now is:
    Till now, we had a select-field with a code like this:
    < html:form action="/timetableAction" method="POST">
    < table width="53%" border="0">
    < tr>
    < td>< html:radio property="dauer" value="semester"
    /></ td>
    < html:select property="semester" size="1">
    < htmlptions name="semesterList" />
    </ html:select>
    </ html:form>
    The problem now is, that whenever I use any <html:xy> tag, the tomcat server I use can not show the page, he shows just the headers of the template, but not the
    content.-jsp-File where the form would be in. He stops right in the middle of the html page, when he notices the <html:xy> tags.
    And the funny thing is, that he has no problem to show a page when there is a <html:errors> within it? Why could this be? the struts-html.tld File is well included and teh Tomcat Server shows no exceptions.
    Waiting for you answers and thanks

    Thank you, I already got the answer in another forum

  • Problem in submiting the form onchange of html:select

    I am using WSAD 5.0 and working on a small application with struts.
    I have following code where I want to submit the form if user selects any option from the list. Problem is when i select any option it is giving error that this property is not supported. Following is my code
    <html:form action="/NewUserAction1">
    <tr>
                   <td>
                        <font color="Blue">
                             <b><bean:message key="NewUser1.CountryName" /></b>
                        </font>*
                   </td>
                   <td>
                        <html:select property="state" onchange="submit();">
                             <html:option value="default">select state</html:option>
                             <html:option value="bangalore">Bangalore</html:option>
                             <html:option value="delhi">Delhi</html:option>
                        </html:select>
                   </td>
              </tr>
         </html:form>
    Please help me someone why i am not able to submit the form on onchange event of <html:select>
    Thanks.

    I got the solution :)
    Finally I figured out that
    by default, struts gives <html:submit/> tags a name of
    "submit". Thus there was a namespace collision in the
    form object, with the submit button overriding the
    form's submit method. I fixed the problem by changing
    the name of the submit button. Something like this
    works great:
    <html:submit property="submitPage">
                        <bean:message key="NewUse1.Submit"/>
                   </html:submit></td>
    Now i am able to submit the form.
    Thanks alot.

  • Use of titleKey attribute in html:select tag

    Hi,
    There is one "titleKey" attribute to create mouse over pop-up texts taking key values from property files in case of i18n. It works for every struts specific tag like <html:text titleKey="help.rmc.name"/> or <html:checkbox titleKey="help.rmc.name"/> except for <html:select> tag which is used for creating combo box or list box. But this tag contains the titleKey attribute.
    Please give me some suggestions how to implement this mouse over pop-up texts in case of <html:select> tag

    Hi,
    There is one "titleKey" attribute to create mouse over pop-up texts taking key values from property files in case of i18n. It works for every struts specific tag like <html:text titleKey="help.rmc.name"/> or <html:checkbox titleKey="help.rmc.name"/> except for <html:select> tag which is used for creating combo box or list box. But this tag contains the titleKey attribute.
    Please give me some suggestions how to implement this mouse over pop-up texts in case of <html:select> tag

  • How to display html:select in Edit page using same options as in Add page

    Hi,
    <html:select property="tblAssociateDetailsVisaType">
                <html:option value="H1">H1</html:option>
    </html:select>I want small help -
    I have two functionalities 1.add 2.Update
    In Add i have nearly 10 dropdown lists with average 20 options, when i submit into DB stored a single record.
    Now when i want to Edit that same record , i am just getting the value from DB and displaying as <td><html:text property="tblAssociateDetailsVisaType" value="<%=VisaType_page%>" size="10"/> which is a wrong way!
    But, i am struggling in showing the same dropdown list with all the option with the option retrieved from the DB on top with <html:select ..... selected>!
    Please help me how to do ?
    I would like to make you of .properties file in doing so ! Which avoids recompiling!
    Thanks in advance!
    Edited by: ganeshtyarala on Dec 17, 2007 11:57 AM

    You could store all of the options in a collection and then loop through it and compare it to the value that was returned. (collection contains beans with value and label attribute)
    This is the code I use.. it is using JSTL tags, but you could implement the same using other methods.
    When my application loads I query the database to get the possible values for the drop down and then load them into the the form.
    <div class="fieldSpan">
    <select name="rewardTypeCode" id="rewardTypeCode">
              <c:forEach var="rewardTypeCodes" items="${sessionScope.myActivity.rewardTypeCodeList}">
                   <option <c:if test="${sessionScope.myActivity.rewardTypeCode == rewardTypeCodes.value}">selected</c:if>
                        value="${rewardTypeCodes.value}">${rewardTypeCodes.value} - ${rewardTypeCodes.label}</option></c:forEach></select></div>

  • Passing collection in JSTL html:select onChange event javascript

    I'm trying to pass an object from the form to a javascript function to change text box values when the value of a select field is changed.
    On the jsp page, I have access to the collection called rows.
    I also have an html:select field that I need to use the onChange event to change other fields on the page. I can certainly call a javascript function on the onChange with no problem. But I need to take it one step further. I need to send the javascript function the collection called rows, so I can set other fields' values on the jsp page to the values of the selected row.
    This (or some facimile) is what I want to do:
    <html:select name="currentForm" property="value(id)" onChange="fillUomForm(this.form,this,rows);">
      <c:forEach var="row" items="${rows}">
          <c:choose>
               <c:when test='${row.id == currentForm.stringValues["id"]}'>
                    <option value="<c:out value='${row.id}'/>" selected>
                         <c:out value="${row.id}"/>
                    </option>
               </c:when>
               <c:otherwise>
                     <option value="<c:out value='${row.id}'/>">
                        <c:out value="${row.id}"/>
                     </option>
               </c:otherwise>
           </c:choose>
        </c:forEach>
    </html:select>Of course, rows is not recognized when I try to run this.
    I have tried replacing rows with
    <c:out value='${rows}'/> but that did not work.
    How can I do this?
    thanks,
    Walter

    sigh.
    Another user mixing up JAVA and javaSCRIPT.
    Java runs on the server. It generates an HTML page, and stops running.
    When the client receives the HTML page it can start running javascript.
    The only way java code is run again is if you make another http request. - ie the next time you click a link or submit a form.
    Most of the time that results in reloading a new page.
    You have two options
    1 - Download all the information you might possibly want/need as part of the JSP page. Then the javascript onclick event can retrieve it from javascript memory.
    2 - Make the onchange event submit an HTTP request, and then pick up the response, and do with it what it will. AJAX is a technology that lets you update the page without refreshing it completely.
    Hope this helps,
    evnafets

  • Default UIPicker in UIWebView for html select drop down- too large font.

    Hi everyone,
    The default picker that is used for selecting options from html select tag (drop down) in a UIWebView is cutting off our data.
    I could use labels if it were not in a web view, but can't work out how to adjust the picker used in web view.
    The only way I can think is the detect selection using js, overide the picker with a custom picker and then send selection back to page. Seems complicated so i'm trying to find out if there is an easier/better way?
    The data is quite long so I do need to reduce font size. As there are quite a lot of options the drop down much more suitable to radio buttons for instance.
    I have noted the quick connect framework but seems like an overkill and this is an app that is already live so I don't really want to add a new framework just for an update.
    Any advice?

    Hi K T thanks for your reply
    In the first example of real data that I have used, it is cut off in both orientations. Only one of the options by one character of so but this forces a '...' to be added in the middle and it to be cut off even more.
    Ideally I would like to bring the font size down and make it two lines.
    Cheers

  • Html:select inside logic:iterate

    hi,
    I am having a string type corresponding to the select attribute in my form bean. Since this select tag is inside the logic:iterate all the names of the select boxes are same. i.e myLabel in this context. So, how can i set the value to select box. do i need to change the data type for labelValue in form bean.
    my form bean is given below:
    here the listTotal is the total of the combo and listValue is the individual combo
         public ArrayList listTotal;
         public Collection getListTotal()
              return (Collection)listTotal;
         public void setListTotal(ArrayList total)
              this.listTotal = total;
         public ArrayList listValues;
         public void setListValues(ArrayList values)
                   this.listValues = values;
         public ArrayList getListValues()
              return  listValues;
                         String myLabel;
         public String getMyLabel()
         return myLabel;
         public void setMyLabel(String myLabel)
         this.myLabel = myLabel;
    And i m setting the values in the action class
              ArrayList listTotal = new ArrayList(1);
              ArrayList listValues = new ArrayList();
              listValues.add(new LabelValueBean("k1", "Value1"));
              listValues.add(new LabelValueBean("k2", "Value2"));
              listValues.add(new LabelValueBean("k3", "value3"));
              listTotal.add(listValues);
              listValues = new ArrayList();
              listValues.add(new LabelValueBean("l1", "Value4"));
              listValues.add(new LabelValueBean("l2", "Value5"));
              listValues.add(new LabelValueBean("l3", "value6"));
              listTotal.add(listValues);
              listValues = new ArrayList();
              listValues.add(new LabelValueBean("m1", "Value7"));
              listValues.add(new LabelValueBean("m2", "Value8"));
              listValues.add(new LabelValueBean("m3", "value9"));
              listTotal.add(listValues);
              employeeForm.setListTotal(listTotal);
    jsp code
    <logic:iterate id="listValues" name="EmployeeForm" property="listTotal" indexId="index">
    <tr><td>
    <html:select property="myLabel" >
    <html:options collection="listValues" labelProperty="label" property="value"/>
    </html:select>
    </logic:iterate>

    hi,
    instead of having it as a array i thought of going for an array list so that the manipulation would be much easier. ok here is my code.
        //This is the array list for names of the drop downs.
        private ArrayList selectedList;
        public ArrayList getSelectedList()
            return selectedList;
        public void setSelectedList(ArrayList pselectedList)
           this.selectedList = pselectedList;
        public ListValueVO getSelected(int index)
           return (ListValueVO) selectedList.get(index);
        }I have already mentioned in my previous posts that i have 3 lists in my form bean. One list for individual combo box. Another list for total number of combo boxes. The third list for the names of the combo boxes. Pls let me know whether i m going in the correct direction or not.

  • Html:select - very confusing

    I am having a lot of difficulty understanding how the html:select works - especially if you're working with different ypes of containers e.g. hashmaps, lists, collections. I'm especially having trouble with lists. Here's what I have (I'm building a struts application):
    Action Class
    List bdates = dbconfig.getBusinessDates();
    httpServletRequest.getSession().setAttribute("BusinessDates", busDates );JSP Page
    <%@ page import "import java.util.List" %>
    <%
    List getBusDates = (List) session.getAttribute("BusinessDates");
    request.setAttribute("busDate", getBusDates);
    %>
    <html:select property="businessdate">
            <html:options collection="busDate" property="bdate"/>
    </html:select>I get an error saying no get property found for bdate in bean. So then I manually go to my ActionForm for this JSP page and add bdate as a string variable and its getter and setter functions. But it still doesnt work.
    Can someone please explain to me how I can use a List with an Html:select and html:option tags in JSP?
    Any assistance much appreciated.

    1) There's no need to pull the collection out of the session and put it in the request...
    <html:options collection="BusinessDates" scope="session" property="bdate" labelProperty="bdateLabel" />
    2) The property and labelProperty values are used to map to fields in the objects that are in the list. It doesn't matter what is in the list, as long as those classes have methods:
    public String getBdate() {
       return ...;
    public String getBdateLabel() {
       return ...;
    }

  • Html:select border issue.

    Hi,
    I am trying to put a border on a dropdownlist. For the dropdown, I am using html:select tag. I tried giving the border using the style attribute in html:select.(<html:select style="border:1px solid red"). It does not seem to be working. Could someone help me out and guide me in the proper direction. Thanks.

    Are we talking java here? Or is this javascript? If javascript, you know that this is a java forum, and that the two languages are vastly different. If you're asking about java, then sorry, but I'm at a loss to help you as I've never heard of these before.

  • Html:select doesnt set the form property if there is no option tag

    Hello,
    I have a select box that I am dynamically populating through ajax.
    I have it populated in the create screen. I save the form elements saved. I am able to get the data on a detail screen when i do a bean:write
    But when i try to see the selected element on the edit screen. The bean doesnt get populated
    Here is my code:
         <tr>               
    <td >Region:</td>
         <td>                              <html:select name="matterCreateForm" property="region" styleId="regionListBox">
         </html:select>
         </td>
         </tr>
    Can somebody help me with this. If i do an alert of region in javascript it is empty though the form element has a value.
    If I remove the entire select code and use a html:hidden fot the property. It alerts me with the value.
    Your help is appreciated!
    Thanks
    Priya

    After your SQL SELECT on CO_EditForm.cfm, you need a
    <CFIF> that checks to see if any records were retrieved. See
    below.

  • HTML select size attribute on iPad

    The HTML select size attribute specifies the number of visible options in a drop-down list. The example below will show all four entries on the drop-down, however nothing was shown in iPad.
    <html>
    <body>
    <select size="4">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
    </select>
    </body>
    </html>
    Is there a way that I can show all four entires in iPad?

    JimHdk wrote:
    BobTheFisherman wrote:
    JimHdk wrote:
    BobTheFisherman wrote:
    The size attribute is supported in all major browsers, except Google Chrome and Safari.
    Source: http://www.w3schools.com/tags/attselectsize.asp
    The size attribute is supported as usual in Mac OS Safari. In mobile Safari the size attribute does not produce a multiple element list but, rather, a pop-list with multiple elements. The appearance is different but the functionality is the same.
    Using your Safari browser --- Compare this result using Safari OSx http://www.w3schools.com/tags/tryit.asp?filename=tryhtmlselectsize results in 4 items in dropdown.
    and using your Firefox browser this result using FireFox http://www.w3schools.com/tags/tryit.asp?filename=tryhtmlselectsize results in 2 items in dropdown.
    You will notice that Safari does not support the size attribute of the select tag which in this case was "2".
    Message was edited by: BobTheFisherman
    The reason that Mac OS Safari displays 4 items in the example you cite is because the minimum number of items in a selection list that Safari will display is 4. If you try the following example where size is set to 5 and there are seven list items you will see that Safari does, indeed, support the size attribute (with the lower limit of 4).
    Here 5 is specified as the size and only 5 items (of the seven given) will be displayed.
    <html>
    <body>
    <select size="5">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
    <option value="ford">Ford</option>
    <option value="mercury">Mercury</option>
    <option value="lincoln">Lincoln</option>
    </select>
    </body>
    </html>
    So it does not work. It only appears correctly if you want to display 4 or more in the dropdown box.
    As an aside, is this a Safari standard way of implementing the select tag with the size attribute? If so, maybe Safari users should rethink their bashing of Microsoft IE for implementing non-standard functionality. I'm not suggesting that you participate in that activity and I thank you for testing and explaining this Safari quirk.

  • html:select Struts tag problems

    hello
    I've a bean "Profile" in my sessionScope under name "myProfile"
    This bean is defined as
    public class Profile implements java.io.Serializable  {
         private User user;
         private List<Groups> groups;
         private List<Function> function;
         private List<Services> services;
         etc. .-.... getter and setter.....
    }the "services list" is full of data
    now in my jsp I want to print all the services in a select box. I'm using struts so I do
    <html:select property="serviceId">
          <html:options collection="${myProfile.services}" property="idSoc" labelProperty="descrizione" />
                        </html:select>it doesn't works..the console says
    Cannot find bean under name [it.object.Services@16b5518, it.object.Services@19fdafc]
    I've read the documentation.. but I don't understand if in the collection attribute I can put only the name of a bean that identify a collection...
    I can't use EL?
    I try do use a bean:define and to put its name in the collection attribute
    <bean:define id="myBean" value="${myProfile.services}"/>
                   <html:select property="societaId" >
                             <html:options collection="myBean" property="idSoc" labelProperty="descrizione" />
                        </html:select>but it still doesn't work.. it says
    Cannot create iterator for [it.object.Services@16b5518, it.object.Services@19fdafc]
    what the way to solve this problem
    thanks
    martina

    <html:select>
    <html:optionsCollection name = "myProfile"
    property = "services" value ="idSoc" label =
    "descrizione"/>
    /html:select>yes evnafets
    you're right
    this code works!
    but there's a problem. To simplify this post I say I've a bean with a Collection inside that I want to iterate.
    In my real application I've a session bean with another bean inside that contains the Collection. I've one more level (3 levels instead 2)
    whit the code you suggest I can't search inside it...
    I mean over myProfile I've onother bean that contains it and it's in the session
    bean1 -> myProfile -> List of Services
    from the session I can take by name only the "bean1"
    do you know what's the solution in this case?
    I've used some code like this
    <bean:define id="myBean" name="bean1" property="profilo"></bean:define>
    <html:select>
            <html:optionsCollection name = "myBean" property = "services" value ="idSoc" label = "descrizione"/>
    </html:select>it works..as you suggest I can specify only attribute names so I think this is the right way... or?!
    thanks a lot for yor help
    martina

Maybe you are looking for

  • How can I filter a column based on data in another list.

    I have two lists: List A: Business Unit | BU Services BU1 | Service 1 BU1 | Service 2 BU1 | Service 3 BU2 | Service 4 BU2 | Service 5 BU3 | Service 6 BU3 | Service 7 List B: Sales Rep | Business Unit | Service Jonny Cash | BU3 | Service 7 Kitty Wells

  • Apple TV and Multiple iTune accounts

    I just got a new Apple TV and I was wondering if it is possible to sync two iTune accounts to it? Currently it looks like only one account can send movies to it. Please help.

  • Extract data from a BW 7.0 cube to a SQL DB using Data Services XI

    Hi Gurus, We are trying to extract data from a BW 7.0 cube to a SQL DB using Data Services XI, the issue is that we can not read text without making "joins" between SID in the fact table and the master data tables. Do you know if it is posible to rea

  • FB (Burrito) - Swap Components in DesignView

    Hi there, I have a pretty basic question but cannot seem to Google the info. Here's a common scenario (for beginners, perhaps more than pros): You start laying out your application - for example - a TabNavigator populated with an HGroup, which is pop

  • How do I recover .psd files

    Is it possible to recover the original psd file if a cropped section has taken the name of the main image from which the section was cropped? I clicked on SAVE not SAVE AS and of course the crop assumed the original file name....Is there any way back