SelectManyListbox : How to set the value in the bean ?

Hi,
How can I set the selected values from a selectManyListbox in the bean ?
My page:
                    <li>
                         <div class="box_multiple_selects clearfix">
                              <div>
                                   <span>Esportes Selecionados</span>
                                   <h:selectManyListbox id="esportes_selecionados" size="10" value="artigoDetailsBean.esportes"/>
                              </div>
                              <div class="btns_fluxo fl">
                                   <button value="<<" name="all_right_hand">>></button>
                                   <button value=">" name="one_right_hand">></button>                                   
                                   <button value="<" name="one_left_hand"><</button>
                                   <button value="<<" name="all_left_hand"><<</button>
                              </div>
                              <div>
                                   <span>Esportes Cadastrados</span>
                                   <h:selectManyListbox id="esportes_cadastrados" size="10">
                                        <f:selectItems value="#{artigoDetailsBean.esporteList}" />
                                   </h:selectManyListbox>
                              </div>
                         </div>
                    </li>
"It´s a move right-left panel". In the right listbox are the database data, and the user click in the left arrow to move the elements (options) from right listbox to the left, and I´d like to get the selected values from the left listbox.
The bean:
public class ArtigoDetailsBean {
private Collection<String> esportes;
     public Collection<String> getEsportes() {
          return esportes;
     public void setEsportes(Collection<String> esportes) {
          this.esportes = esportes;
     public List<SelectItem> getEsporteList() {
          List<SelectItem> esportes = new ArrayList<SelectItem>();
          for(Object esporte: artigoDetailsCommand.getEsporteList() ) {
               esportes.add( new SelectItem( ((EsporteVO)esporte).getId().toString(), ((EsporteVO)esporte).getDescricao() ) );
          return esportes;
Thanks in advance,
Sergio Stateri Jr.
[email protected]

This blog shows an example of what you are trying to do - when the user clicks the left arrow it triggers an action event that puts the value into the left list, and vice-versa:
[http://weblogs.java.net/blog/driscoll/archive/2008/11/jsf_20_the_swit_1.html|http://weblogs.java.net/blog/driscoll/archive/2008/11/jsf_20_the_swit_1.html]
Ignore the 'JSF 2.0' in the header - it's not JSF 2.0 in this example!
Also - don't post your email address on the forums - you might get spammed :)
m

Similar Messages

  • How to set default values on the screen painter parameters?

    Hello ABAP Gurus,
    I would just want to ask how to set default values on the screen painter parameters.
    Thank you for your replies.

    Hi,
    To set default values for screen painter parameters initialize the field names with default values in the PBO module....
    say u have the field name as f_field1....
    in the PBO of that screen initialize it....
    f_field1 = '100'  "here 100 is the default value.
    <b>reward points if useful.</b>
    regards,
    Vinod Samuel.

  • URM How to set default value in the "New Check-in" - "Folder" field

    Hello everyone,
    I'm trying to find out how to set the default value for the "folder" field in a check-in profile created using the Configuration Manager. If I browse to the folder in the "Browse Content -> Folders" menu and check-in a file inside the folder, it will fill this field automatically. I need to replicate this behavior using the "New Check-in" drop-down menu and selecting a profile, in other words, associate a Folder with a check-in profile.
    I know it was possible to do so in previous versions using the folders_g component, but I'm unable to figure out how to accomplish it with the new FrameworkFolders component.
    Any help is greatly appreciated.
    Thank you.

    Hello,
    It is working fine try this.
    PARAMETERS :
    y_p_list TYPE char32  AS LISTBOX VISIBLE LENGTH 22
                                  MODIF ID rsg. .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR y_p_list.
      MOVE: text-200 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      MOVE  text-203 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      MOVE  text-210 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      MOVE  text-211 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      MOVE  text-204 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      MOVE text-205 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      MOVE text-206 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      MOVE text-207 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      MOVE text-208 TO y_wa_listbox-field.
      APPEND y_wa_listbox TO y_i_listbox.
      CLEAR y_wa_listbox.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = 'FIELD'
          dynpprog        = sy-repid
          stepl           = 1
          value           = ' '
          value_org       = 'S'
          display         = ' '
        TABLES
          value_tab       = y_i_listbox[]
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
      IF sy-subrc <> 0.
      ENDIF.
      REFRESH y_i_listbox.

  • How to set a value to the TextField on keyPress Event?

    Hai,
    I am using Jdev 11g.
    In my jspx page,i have an Input Text...I want to set a value to that input text when i press any button (say F2) inside that text field .I tried with clientListener and server Listener..But it is not set.
    In jspx page
    *========*
    <f:facet name="metaContainer">
    <trh:script>
    function onKeypressClientListner(evt) {
    var _txtField; var valueStr;
    _txtField = evt.getSource();        
    if (evt.getKeyCode() == AdfKeyStroke.F2_KEY) {
    valueStr = _txtField.getSubmittedValue()
    AdfCustomEvent.queue(_txtField,"onKeyPressServerListner",{payload:valueStr}, true); evt.cancel();
    </trh:script>
    </f:facet>
    <af:inputText label="Label 1" id="it1"
    binding="#{backing_CheckKeyPress.itxtInputText}">
    <af:clientListener method="onKeypressClientListner" type="keyUp"/>
    <af:serverListener type="onKeyPressServerListner"
    method="#{backing_CheckKeyPress.serverKeyListner}"/>
    </af:inputText>
    In CheckKeyPress.java
    *======*
    public void serverKeyListner(ClientEvent clientEvent)
    System.out.println("Inside Server Listener");
    itxtInputText.setValue("Hai");
    AdfFacesContext.getCurrentInstance().addPartialTarget(itxtInputText);
    After executing this,program will give output as Inside Server Listener . But the TextField value is not setting..

    I got it..Just set immediate property to true

  • How to set hidden value in managed bean?

    Hi
    I have the following :
                           <a4j:commandButton
                                          id="commandButton3"
                                          action="#{backing_CustSearchBean.serchCustomer}"
                                          image="images/btn_search.gif"
                                          style="position: relative; margin-right: 5px;"
                                          actionListener="#{backing_CustSearchBean.checkText}"
                                          immediate="true"
                                          status="wait"
                                          oncomplete="showQuickCreate()"
                                          >  
                                <h:inputHidden id="jsfHidden" binding="#{backing_CustSearchBean.jsfHidden}" />
                                  <a4j:status id="wait">
                                    <f:facet name="start" >
                                      <h:graphicImage url="images/SpinGear2.gif" style="position: absolute; left: 378px; top: 216px; width: 19px; height: 18px;"/>
                                    </f:facet>
                                  </a4j:status>
                     </a4j:commandButton>when the action goes in the managed bean I want to set the value of hidden parameter "jsfHidden" in managed bean and catch it in showQuickCreate (oncomplete="showQuickCreate()" ) javascript function on return to the page.
    Please help, how should I do it?

    I know nothing about a4j, but if you want to pass new parameters from JSF to the backing bean, then use f:param for commandlinks or f:attribute for commandbuttons.
    The h:inputHidden just saves backing bean properties from request to request. You can't set or change it from within the JSF.
    Not sure if the f:attribute will work for the a4j commandbutton (check if they have a support forum at their website?)
    Also see http://balusc.xs4all.nl/srv/dev-jep-com.html about passing parameters and accessing objects and beans in the facescontext.

  • How to set render value in a bean class

    HI,
    I am new to jsf,in a jsf I put two images using <h:graphicImage> tag now my requirement is when the page is loaded one image has to appear and whenever I click on the first image the first image has to disappear and second image has to appear....I am trying this one but I am unabel to get the solution....can any one please tell me.and also can u tell me where can I get information about creating the bean class and how to create the objects for the components in a bean calss??
    Thanks...

    I think you can start from jsf basics here :
    http://jsf.javabeat.net/articles/2007/05/java-server-faces-introduction/

  • How to set default values in the PO feilds

    Hello,
    Can please somone let me know how can I default a particular tax code "X" on a Purchase Order at the item level in the invoice tab..
    Any help would be greatly appreciated....
    Thanks

    Dear ,
    You can set it in the info record > Purchasing Organization data 1. In standard customizing,the default value for tax exist for LIV module in SPRO-Materials ManagementLogistics Invoice VerificationIncoming InvoiceMaintain Default Values for Tax Codes
    Regards,
    w1n

  • How to set default value to the variable !!!

    Experts,
    I have created a variable ZDATE, which is in variable entry screen of the query. and this variable is mendatory .
    Now, i want to put default value of this variable ( Which can be done from the Variable Properties screen , on the Default Values Tab )
    But , thru there i can only put selected value. my requirement is to show system date - 1 ( Previous date )
    how do i get that ?
    Thanks

    Hi,
    You would need to write a variable exit under I_STEP = 1 to get the previous day populated on your variable screen.
    Regards,
    Murali.

  • How to set new value for the existing jar file

    Help:
    I am wondering if there is a simple to update value for Manifest-Version in a existing jar file?
    Thanks!

    The jar command's -u option is about as easy as I know.
    See the jar command documentation for the details.

  • In flex, How to set a value to one parameter, the parameter defined in a cffunction in a cfc file

    In flex, How to set a value to one parameter, the parameter
    defined in a cffunction in a cfc file, In the cffunction there are
    much cfargument, I want set a value to one of them, such as the
    cfc:
    <cffunction access="remote" name="myShow" output="false"
    returntype="struct">
    <cfargument name="ID" type="numeric" default=0>
    <cfargument name="GoodsID" type="string" default="">
    <cfargument name="DestTime" type="string" default="">
    <cfargument name="DestCount" type="numeric" default=1>
    How I set a value to only parameter one of them , such as set
    GoodsID when use mx:remoteObject.
    Thanks for your help

    Got maybe a solution for you, I have just tested it.
    So, the idea is to use intermediate variables. Imagine Var1 and Var2 variables that you refresh with your more or less complicated queries. Then what you can do is to refresh your final variable Var3 with a query using your intermediate variables. Here is an example for Oracle:
    select #Var1+#Var2 from dual
    This way you can make a chain of dependent variables: Var3 is using Var2 and Var2 is using Var1.
    Hope it helps.
    Shamil

  • How to set the value in the xml node.

    Hi
    I am having the application PDF which can be submitted by user using the button. while submitting 
    i am using below code to set the value in the xml node.
       xfa.data.assignnode("employee.id","123",0):
    So its generating the xml like below.
    <employee>.
    <id>123</id>.
    </name>
    </employee>
    Now i need to generate the xml like  below.
    <employee id= "123" >
      </Name>
    </employee>
    So how to set/create the id node like above?
    Advance Thanks.
    Regards,
    Dhiyane

    Hi Dhiyane,
    You will have to set the contains property if the id node to "metaData", that is;
    xfa.data.assignNode("employee.id","123",0);
    xfa.data.employee.id.contains = "metaData";
    Very clumsy if you have a number of them, in which case you might want to look at using E4X.
    Good luck
    Bruce

  • How to set a value wo resending the page?

    hello,
    I have a simple question.
    Here is the scenario i need to implement:
    Two items on the page:
    1. "select list" returns list of values ( distinct )
    2. "popup" item.
    It should work in this manner:
    a. initial value is derived ( sql stmnt to the DB ) from the value of the "select list" ( which is a dynamic lov );
    b. if user decided to change this value -> click on the popup icon and the list of values will be presented based on the dynamic LOV. Selecting one of those will override the initial value of the item.
    What i do NOT want to do is to submit the page to get this initial value ( from select ).
    Hope it's clear.
    thank you
    Andrew

    I've implemented a solution recently which I think will help you. Put the following Javascript into the HTML Header section.
    * setPageItemSessionData()
    * This function is called to set a page item's html + session
    * data to a specific value.
    * Arguments:
    * pageItemName - the page item to change
    * val - the value to set it to
    function setPageItemSessionData(pageItemName, val)
    try
    /* need to take data passed into this function
    and store in session variable as named in pageItemName */
    /* store in HTML field only here */
    document.getElementById(pageItemName).value = val;
    /* store in session variable - don't really know how this works
    but it does !*/
    var l_Return = null;
    /* get new http post request */
    var get = new htmldb_Get(null,html_GetElement('pFlowId').value);
    /* add http post variable/data */
    get.add(pageItemName, val);
    /* submit post over http - receving end will take data and store
    in session variable */
    gReturn = get.get();
    catch(e)
    alert("setPageItemSessionData: Exception - " + e);
    Create a hidden text item which will be used to contain the selected Select List value (not display value). In my example this is called P162_OUTGRPIDD but it can be called anything you want.
    Now put the following javascript into the Select List's HTML Form Element Attributes cell:
    onchange="javascript:setPageItemSessionData('P162_OUTGRPIDD',this.value);"
    The hidden text element will be changed whenever the Select List is changed. It will be set to the value (not the display value) of the Select List.
    The value of the hidden item is saved in session state (as well as HTML) so that it can be used by the POPUP LOV
    Now in the POPUP LOV item you can reference P162_OUTGRPIDD in the where clause, as the example below shows:
    select sklpin d, sklpin v
    from pdrskl, pdrgrp
    where grpidd1 = grpidd and
    grptyp = 'R' and
    pdrskl.itpidd1 = :P162_ITPIDD and
    grpidd = :P162_OUTGRPIDD and
    bldagtidd1 is null
    order by sklpin asc

  • How to prevent numericstepper from setting the value to the defined Maximum when a number greater than maximum is entered in by keyboard and user hits the "Enter" key.

    I need to set the Maximum so that the use can use the mouse to change the value of numericstepper (and not go over a certain number), but at the same time I have to allow the user to enter their value by typing in the text field. When the user enters a number greater than the Maximum, I disable the "Ok" button of the dialog and show a red warning(error message). The issue is that the user can hit "Enter" and numeric stepper would set the value to the Maximum and the dialog box would close and the rest of code would run. I want the numericstepper not to change the value and keep showing the warning even if the user hits the "Enter".
    Note: Setting maxChar does not help since my maximum is 1000, and user might enter 5555
    I would appreciate the help.

    Thanks for trying to help, But
    The issue is that if I set the maximum value of stepper 1 greater than the max value that I want, then the user can select an invalid value(of myMax + 1) when he clicks on the UP arrow of the numeric stepper(which is not acceptable for what I am working on).
    I need to preserve the users invalid number, while not letting the user to select an invalid number by clicking UP key.
    I noticed that when the user enters a number greater than the Maximum, and then click on the down arrow, it would set the value to 1 less than the maximum. This is not acceptable either.

  • I want to set the value to the radiobutton dynamically.How it possible

    Hi all,
    I want to set the value to the radio button dynamically.but its giving undefined.
    below is the code...
    <table>
    while(rSet.next())
    String sim=rSet.getString(1);
    System.out.println("the sim value is:"+sim);
    %>
    <tr class="forsmalllabel">
    <td><input type="radio" name="acsRadio"
    value="<%=rSet.getString(1).toString().trim() %>" onClick="validate(this.form)" > </td>
    </tr>
    <% } %>
    </table>
    sim variable giving the correct value ...but here ..
    whenever I am clicking on the button..it giving undefied message.
    my script is below..
    <script language="javascript">
    function validate(value)
    alert("the value is:"+document.ASCCodeform.acsRadio.value);
    return true;
    </script>
    any one help me on this..
    urgent.
    Thank you,
    D.Nagireddy.

    swish is correct, it can be an array of radio button or a single button. If you have created more than one radio button your will have to use
    document.ASCCodeform.acsRadio[x].valuebut if it is only one you will make it:
    document.ASCCodeform.acsRadio.value

  • How to set the value of the column as the value of other table coulmn.

    dear friends
    i have a table SO_D having coulm (so_no,item_cd,qty,rate,unit)
    and anather table so_tax(so_no,tax_code,tax_percent,tax_amt,item_cd,flag)
    now i have ALL VALUES in the first table i.e so_d
    but in table so_tax i have all values except item_cd.
    the values in the so_tax table comes from so_d by the formula ((qty*rate)*percent(which in so_tax table))/100) corresponding to each item_cd
    here so_no and item_cd are primary key in so_d and foreign key in the so_tax.
    and for each so_no the item_Cd is unique and my repeat for new so_no in the table so_d.
    now i have the problem that in the table so_tax the value in the coulmn item_cd is blank .
    but the tax amount is calculated for each item_cd .
    now i want to update the table with the item_Cd values ad they are in the so_d table according to the tax amount calculated by using above formula.
    please suggest the solution..
    any query please ask
    i can provide values for the each table..
    thanks in advance

    Data sample for the table so_d is
    SO_NO ITEM_CD QTY RATE UNIT
    AT0064 12000135 15 22163 NOS
    AT0064 12000136 15 20337.82 NOS
    AT0064 12000137 15 21902.27 NOS
    AT0064 12000138 15 20337.82 NOS
    AT0064 12000139 15 20337.82 NOS
    AT0149 CO000109 2 20755 NOS
    AT0149 CO000110 1 2502 NOS
    AT0149 CO000111 1 2502 NOS
    AT0149 CO000112 1 2502 NOS
    AT0149 CO000113 1 9328 NOS
    AT0149 CO000114 1 15476 NOS
    AT0149 CO000115 1 82150 NOS
    AT0149 CO000116 1 2915 NOS
    AT0149 CO000117 1 11766 NOS
    AT0149 CO000118 1 2968 NOS
    AT0149 CO000119 1 2968 NOS
    AT0149 CO000120 1 3286 NOS
    AT0149 CO000121 1 7950 NOS
    AT0149 CO000122 1 1908 NOS
    SAMPLE DATA FOR SO_TAX
    SO_NO TAX_CODE PERCENT AMT ITEM_cD FLAG
    AT0064 X02 4 13297 Y
    AT0064 X02 4 12203 Y
    AT0064 X02 4 13141 Y
    AT0064 X02 4 12203 Y
    AT0064 X02 4 12203 Y
    AT0149 V16 14.5 6018 Y
    AT0149 V16 14.5 363 Y
    AT0149 V16 14.5 363 Y
    AT0149 V16 14.5 363 Y
    AT0149 V16 14.5 1353 Y
    AT0149 V16 14.5 2244 Y
    AT0149 V16 14.5 11912 Y
    AT0149 V16 14.5 423 Y
    AT0149 V16 14.5 1706 Y
    AT0149 V16 14.5 430 Y
    AT0149 V16 14.5 430 Y
    AT0149 V16 14.5 476 Y
    AT0149 V16 14.5 1153 Y
    AT0149 V16 14.5 277 Y
    HERE ITE_CD IS BLANK

Maybe you are looking for