SelectMany checkbox value-binded with HashMap String,ArrayList

Hello,
Someone can help me please?
Im trying to create a page with a lot of HtmlSelectManyCheckbox, and i need to value-bind then to the same Object in my BackingBean.
First i attemped to bind all HtmlSelectManyCheckbox with a single ArrayList, but only the last SelectMany had their values inserted on the ArrayList...
So, now im trying to bind all the HtmlSelectManyCheckbox with a HashMap<String,ArrayList>, because i would have just one object and for each entry I would have the checkboxes that were cheked in a single HtmlSelectManyCheckbox.
Now my question: there is a way to make this work?
my code example
Backing bean
private HashMap<String, ArrayList> respostaMatrizCheck = new HashMap<String, ArrayList>();
     public HashMap<String, ArrayList> getRespostaMatrizCheck() {
          return respostaMatrizCheck;
     public void setRespostaMatrizCheck(HashMap<String, ArrayList> respostaMatrizCheck) {
          this.respostaMatrizCheck = respostaMatrizCheck;and the bindings
<h:selectManyCheckbox value="#{backingBean.respostaMatrizCheck['1'] }">
<h:selectManyCheckbox value="#{backingBean.respostaMatrizCheck['2'] }">And the error message given when i tryed this is the following:
javax.servlet.ServletException: ValueBinding for UISelectMany must be of type List or Array
Any help would be welcome.
Thanks,
Ferry

Has anybody solved a problem like this? I am facing the same problem and no response helped me so far.
Here is the web code:
<h:selectManyCheckbox value="#{processor.languages.languages1}">
     <f:converter converterId="languageConverter" />
     <f:selectItems value="#{categoryController.allLanguagesAsSelectItems}" />
</h:selectManyCheckbox>My backing bean "processor" looks like this:
     public Map<String, List<MyObject>> getLanguages() {
          return languagesMap;
     }(The backing bean has no "setLanguages()-method" since I did not need any with Map<String, String> for example.)
The converter I use creates a "MyObject" instance in its "getAsObject" conversion method.
I think everything should be okay then but the exception I get after submitting the page is:
java.lang.IllegalArgumentException: ValueBinding for UISelectMany must be of type List or Array
     org.apache.myfaces.shared_impl.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(_SharedRendererUtils.java:191)
     org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedUISelectManyValue(RendererUtils.java:630)
     org.apache.myfaces.shared_impl.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue(HtmlCheckboxRendererBase.java:308)
     javax.faces.component.UISelectMany.getConvertedValue(UISelectMany.java:308)
     javax.faces.component.UIInput.validate(UIInput.java:350)
.....Edited by: rapthor on Oct 31, 2007 6:39 AM

Similar Messages

  • Value binding with parameters

    Hello
    Is it somehow possible to bind value to back-end data with parameter passing to backend method? See #{databaseConnectionList.delete(dbc)} in the example below. I just need to generate onclick javascripts for each row so if user clicks on the delete action a confirmation dialog box for actual row should display (eg. Are you sure to delete database connection "MyConnection1"?). Please write me the solution, any solution. THANKS A LOT.
    PS: I use MyFaces
    <h:dataTable
         id="databaseConnectionsTable"
         var="dbc"
         value="#{databaseConnectionList.list}">
         ... columns ...
         <h:column>
              <f:facet name="header">
                   <h:outputText value="#{messages.actions}" />
              </f:facet>
              <h:commandLink action="#{databaseConnectionList.delete}" immediate="true" onclick="#{databaseConnectionList.delete(dbc)}">
              </h:commandLink>
         </h:column>
    </h:dataTable>

    Bingo!
    Folks I did figure out the problem. In your environment the vm defaults to Java 1.4, meaning eclipse uses Java 1.4. Now, when you create a new project (as described in steps/clip) using Java 1.5 as the compiler/facet, AppXRay fails to Introspect due to incompatible version.
    Try the following steps to resolve this issue:
    - Correct the JRE used by eclipse,
    Window > Preferences > Java > Installed JREs - If it defaults to JRE/JDK 1.4 version then add JDK/JRE 1.5 and mark it (1.5) as default.- Quit Workshop
    - start > Programs > BEA Workshop > Workshop_Studio_3.x_xxx - Properties - modify Target field to use JDK 1.5 vm
    Ex:
    C:\<Workshop_Home_Dir>eclipse\eclipse.exe -data workspace -feature com.m7.nitrox -application org.eclipse.ui.ide.workbench -vm C:\<j2sdk1.5.0>bin\javaw.exe -vmargs -Xms128M -Xmx512M -XX:MaxPermSize=128M -Dosgi.splashLocation=C:\<Workshop_Home_Dir>Workshop\splash.bmp
    NOTE: Due to the field length limitation, you might have to remove -Dosgi.splashLocation argument.
    - re-launch Workshop
    - retry the steps and you should not hit the reported issue
    FYI:
    - You can refer to Workshop/eclipse log
    * .log within workspace.\.metadata directory
    * workspace\.metadata\.plugins\com.m7.nitrox\wstudio.0.log

  • Localized String with params - Value Binding Expression...

    Hi All:
    I see many e.g.s where a command button / or a label's value can be a localized resource string using the generic value binding expression:
    "#{bundleVarName.keyName}"
    what if the resource string has parameters? for e.g.
    button.caption = Click Me for {0}
    Can we assign a value binding expression with params for button captions etc.
    Please help - I am a newbie in JSF,,,
    regards
    -Somesh

    JSF developers have forgotten about this :)
    Use other tools for displaying such messages (f. e. JSTL) where you need to have parametrized messaged.
    But mostly, non-parameterized JSF will be enough.

  • Checkbox values cannot be read on binder

    Hi,
    I have a form which has couple of checkboxes with as shown below.
    <form name="test" action="get">
    <input type="hidden" name="IdcService" value="SUBSCRIPTION_SERVICE">
    <input type="checkbox" name="chk_test" value="1" /> First
    <input type="checkbox" name="chk_test" value="2" /> Second
    <input type="checkbox" name="chk_test" value="3" /> Third
    <input type="submit value="submit" />
    </form>
    I am using this form to submit some values into the content server.
    When the form is posted, on the content server end I am trying to get the values from binder.
    System.out.println(m_binder.getAllowMissing("chk_test")); prints 3 even though i have selected 1&3. This means when i submit the form I have selected the check box 1,3, m_binder understands or gets only the last value on the checkbox group. Not sure if this is the default behaviour.
    I cant use javascript to club the checkbox values into one hidden variable and send it to the binder as the implementation i am trying has javascript disabled browsers and i want server side validation to happen.
    Any idea why is this happening and is there any solution to over come this.
    Regards,
    S.

    Hey S.
    It looks like the issue you are having is that the 3 checkbox fields are all the same name. When the form submits it will only send the value for the last field with a particular name on the page.
    The other trouble with checkboxes is that if they are not checked then their name isn't even passed in the request.
    To get your code working try something like this:
    <form name="test" action="<$HttpCgiPath$>" method="get">
    <input type="hidden" name="IdcService" value="SUBSCRIPTION_SERVICE">
    <input type="checkbox" name="chk_test_1" value="First" /> First
    <input type="checkbox" name="chk_test_2" value="Second" /> Second
    <input type="checkbox" name="chk_test_3" value="Third" /> Third
    <input type="submit value="submit" />
    </form>
    Then in your java code:
    List selectedItems = new ArrayList();
    for(int i=1; i<4;i++)
    String temp = m_binder.getLocal("chk_test_"+i);
    if(temp != null)
    selectedItems.add(temp);
    //do something with selectedItems
    Hope that helps,
    Andy Weaver - Senior Software Consultant
    Fishbowl Solutions < http://www.fishbowlsolutions.com?WT.mc_id=L_Oracle_Consulting_amw >

  • How to create table with list/map value binding

    I need to display few values in a tabular format. Is it possible to create adf table without having value binding to a VO object. Can I make a table with some list/map combination.
    I want to change the display format with minimum change in the application. Hence I am looking for a change to define a list/map and map it with the table.
    Following is the structure I need to display in.
    |     |Header1|Header2 |     
    |_______|_______|_______|
    |Txt R1 |value 1 |Value 2 |     
    |_______|_______|_______|
    |Txt R2 |Value 3 |value 4 |     
    |_______|_______|_______|
    All the views does not have any relation. Hence I should not create a VO and adding rows of the VO object.
    Edited by: Jaykishan on Jun 10, 2011 11:34 AM

    Yes, you can do it. Create a pojo with the properties(column) you want to display in the table and create a list with the instances of pojos and then you can populate your table using the list.
    Sample:
    //POJO
    public class SamplePojo {
    private String col1;
    private String col2;
    public SamplePojo(String col1, String col2){
      this.col1 = col1;
      this.col2 = col2;
    //add setter and getter methods
    //Inside bean, prepare a list with pojo instances (Assume a getter exists for pojoList)
    pojoList = new ArrayList();
    pojoList .add(new SamplePojo("Value1", "Value2");
    pojoList .add(new SamplePojo("Value3", "Value4");
    etc.
    //Inside jspx
    <af:table value="#{<Bean>.pojoList}" var="pojo" ...>
       <af:column headerText="Header1" ..>
         <af:outputText value="#{pojo.col1}"/>
       <af:column>
       <af:column headerText="Header2" ..>
         <af:outputText value="#{pojo.col2}"/>
       <af:column>
    </af:table>HTH
    Sireesha

  • Problem with checkbox value and app.settings.getSetting()

    Hello everyone.
    I`ve got a problem with getting saved settings for checkbox.
    Saved settings doesn`t apply on checkbox value.
    It`s strange, but it always "true".
    So here piece of code:
    checkMe = 11;    //any value for the first time running
    if (app.settings.haveSetting("savea", "chck")) {                           
                          checkMe = app.settings.getSetting("savea", "chck");  // get saved value, else 11
                          alert("checkMe = "+checkMe)
                        if(checkMe == 11){
                            checkMe= false;   //if there is no saved settings, checkbox value will be false/ unchecked
                            alert("You run this script first time, so manual value will be 'false'")
                            }else{
                                checkMe = app.settings.getSetting("savea", "chck");     // if saved settings exist, get true or false
         alert("Yes, checkMe will = "+checkMe)       
    win.checkPanel.chkOne.value = checkMe;  /// checkbox value will equal saved checkMe
    var fff = win.checkPanel.chkOne.value;  // string for alert
    alert("aha! but checkbox value is  = " +fff+ "\n Why so?")     // here we`ve got always "true"
    win.checkPanel.chkOne.onClick  = function () {
        var path11 = win.checkPanel.chkOne.value;  //  checkbox value to variable
        app.settings.saveSetting("savea", "chck", path11);  //saving checkbox value
        alert("Saved this value - " + app.settings.getSetting("savea", "chck"))
    win.checkPanel.chkOne.value is always true.
    Can someone exmplain why and how to get rid of this static value?
    P.S. just in case, here is full code:
    function mainFun()
        this.windowRef = null;
    mainFun.prototype.run = function()
        /*----- UI -----*/
              var retval = true;
              var win = new Window("palette", "Check option", [150, 150, 460, 455]);
              this.windowRef = win;
              win.checkPanel = win.add("panel", [25, 150, 285, 265], "Checkbox");
              win.checkPanel.chkOne = win.checkPanel.add("checkbox", [10, 15, 125, 35], "Checkbox One");
              //win.checkPanel.chkTxtOne = win.checkPanel.add('edittext', [140, 15, 230, 35], '');
         win.quitBtn = win.add("button", [110,275,200,295], "Close");
    checkMe = 11;    //any value for the first time running
    if (app.settings.haveSetting("savea", "chck")) {                           
                          checkMe = app.settings.getSetting("savea", "chck");  // get saved value, else 11
                          alert("checkMe = "+checkMe)
                        if(checkMe == 11){
                            checkMe= false;   //if there is no saved settings, checkbox value will be false/ unchecked
                            alert("You run this script first time, so manual value will be 'false'")
                            }else{
                                checkMe = app.settings.getSetting("savea", "chck");     // if saved settings exist, get true or false
         alert("Yes, checkMe will = "+checkMe)       
    win.checkPanel.chkOne.value = checkMe;  /// checkbox value will equal saved checkMe
    var fff = win.checkPanel.chkOne.value;  // string for alert
    alert("aha! but checkbox value is  = " +fff+ "\n Why so?")     // here we`ve got always "true"
    win.checkPanel.chkOne.onClick  = function () {
        var path11 = win.checkPanel.chkOne.value;  //  checkbox value to variable
        app.settings.saveSetting("savea", "chck", path11);  //saving checkbox value
        alert("Saved this value - " + app.settings.getSetting("savea", "chck"))
              win.quitBtn.onClick = function() {
                  win.close();
        win.center();
              win.show();
              return retval;
    if(typeof(mainFun_unitTest) == "undefined") {
        new mainFun().run();

    Played around with different values, combinations...
    Doesn`t work too:
    checkMe = 111;    //any value for the first time running
    if (app.settings.haveSetting("333", "check")) {                           
                          checkMe = app.settings.getSetting("333", "check");
    alert(checkMe);
                    if(checkMe == 111){
                             win.checkPanel.chkOne.value= false;
                            }else{
                                if (checkMe != false){
                                win.checkPanel.chkOne.value= true;
                                }else{
                                win.checkPanel.chkOne.value= false;
    win.checkPanel.chkOne.onClick  = function () {
        var path11 = win.checkPanel.chkOne.value;
        var path12 = path11.toString();
        app.settings.saveSetting("333", "check", path12);
        alert("Saved value - " + app.settings.getSetting("333", "check"))

  • How to get the value in a hashmap with a key of expression "123-456"?

    Hi all,
    I new to java and having a problem with getting values from a hashmap.here is the code which i wrote
    Map map = new HashMap();
    int m = 123;
    int n = 456;
    String key = String.valueOf(m) + "-" + String.valueOf(n);
        map.put(key, true);
        Now i am trying to get the value and i get an exception
    boolean b = map.get(String.valueOf(m) + "-" + String.valueOf(n));Can someone help me how to pass this expression as key in the hashamp

    Hi corlettk,
    Thanks for your reply. I have defined my map as Map<String, Boolean> selectedIds = new HashMap<String, Boolean>();
                selectedIds.put("123-456", true);           
                int m=123; int n=456;
                                     selectedIds.put(String.valueOf(m) + "-" + String.valueOf(n),true);
                boolean viv = selectedIds.get("String.valueOf(m)-String.valueOf(n)");
                System.out.println(viv);
                My problem is the hashmap key must be set dynamically ("123-456" is just an example) and when i get the value i should be able to pass those varibales in an expression correctly. Please let me know how can i pass an expression like the one above as a hashmap key. Please advise.

  • How to insert a null value to combobox which is bind with datasource

    Hi,
    i am working on c# winforms application. I have 2 comboboxes one is CustomerCbBox and another is OrderCbBox. CustomerCbBox is bind with data source.
    on CustomerCbBox SelectedIndexChanged event data is populated in OrderCbBox from data source. 
    i want to add a null or empty field in CustomerCbBox. all I want is that when the user don't Select Customer Name and OrderNo null or empty data enter in database. but when i click Insert Button it generate error "Object reference is not "object
    reference not set to an instance of an object".
    here is my code.
      private void MainForm_Load(object sender, EventArgs e)
    production pd = new production();
    CustomerCbBox.DataSource = pd.Customer();
    CustomerCbBox.DisplayMember = "Cust";
    CustomerCbBox.ValueMember = "CustId";
     private void CustomerCbBox_SelectedIndexChanged(object sender, EventArgs e)
                      try
                          string PartyName = CustomerCbBox.SelectedIndex.ToString();
                           PONum1.DataSource = pd.GetPOnumActive(PartyName1);
                              PONum1.DisplayMember = "PONum";
                              PONum1.ValueMember = "PONum";
                      catch (Exception ex)
                          MessageBox.Show(ex.Message);
         Please help me to solve this problem thanks.      

    Hello,
    We could check whether the user has selected any items before adding that to database.
    if (CustomerCbBox.SelectedIndex > -1)
    // do something
    }else{//add dbnull to database}
    And for adding null to databse, we could pass DBNull.Value instead.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Need help with locating a key using a value in a HashMap.

    I am quite new to Java and programming, and am just learning this in High School (enjoying it thoroughly). Sorry if I don't respect the etiquette or formatting of this board (it's unintentional).
    I am using the book, Objects First Wth Java A Practical Introduction Using Blue J and am working on extensively improving the "World of Zuul" project. Which is a text-based adventure game.
    Here is a code sample;
    public String getNameFromList(String name)
      boolean found = false;
      Set pairSet = xItemList.entrySet();
      for(Iterator iter = pairSet.iterator(); (found == false && iter.hasNext());){
      Item currentItem = (Item) iter.next().getValue();
      String currentKey = currentItem.getName();
      if(name.equals(currentKey)){
        String changedName = iter.next().getKey();
        return changedName;
    error; cannot resolve symbol:
    method: getValue()xItemList is a HashMap with String keys, and Item values.
    The relevant field of Item is name, which is a string.
    The currentKey local variable is a little misleading, it is the current name, but acts as the 'key' when looking for the actual key.
    changedName (if the parameter name is found from the item.getNames()), is what the method returns, the key associated with a object (by looking at the object's field).
    My objective for this method is for it to have a name as a parameter, which it searches for in the HashMap (by Iteration over the entrySet - or I suppose iteration over Set values(), but this loses which object value is tied to which key, doesn't it?), and returns the respective key.
    Any help would be very much appreciated (even if it is telling me that this can't be done with HashMaps!).

    It's not clear to me what your question is, or if indeed you even have a question.
    You seem to be having a problem with types. Iterators return Objects.
    So in this line:
      Item currentItem = (Item) iter.next().getValue();The iterator's next() method is returning an Object, and you're trying to call getValue() on that Object. But Object doesn't have a getValue() method. That would explain your error message. Map.Entry does; you apparently meant to call Map.Entry's getValue() method. You would cast the result of iter.next() to Map.Entry before you call getValue().
    Also you're calling next() on your iterator twice in the body of the loop, which means you're getting two different values... this is probably not what you intend.
    But you're making this more complicated than it needs to be anyway.
    Why are you iterating through the set of entries in the HashMap?
    The whole point of a Map is that you get an item using an object as the key. Just do xItemList.get(name). Right?

  • Problem in setting vector or string[] as the "value object" in hashmap

    Hey I am new to this forum.
    I am doing a project in which i need to store a array of strings as "value object" for a unique key in hashmap.
    as I populate the hashmap from external file according to key and setting the string[]. The hashmap is taking the value field same for each entry i.e the last field as i keep updating the same variable and then putting it into hashmap.
    Please give solution to my problem???
    if question not clear,please tell me- i will add more information
    Edited by: AnkitNahar on Apr 4, 2009 8:06 AM

    I tried using the method suggested by you...but it is of same case as using the string[].
    I need to loop the statements in which the hashmap is populating so cant change the variable names in the dd.put() statements. When the below code executes it shows the same set of string for both the keys, that was the problem i was facing with string[].
    here is the example with two entries....same thing in looping.
    HashMap<String,Set<String>> dd=new HashMap<String,Set<String>>();
    String word = "Hello";
    Set<String> alternativeWords = new HashSet<String>();
    alternativeWords.add("Hi");
    alternativeWords.add("Yo");
    dd.put(word, alternativeWords);
    alternativeWords.clear();
    alternativeWords.add("hey");
    word="yep";
    dd.put(word,alternativeWords);
    System.out.println(dd.get("Hello").toString());
    System.out.println(dd.get("yep").toString());

  • Value binding not working with rendered attribute

    In my jsf page i'm encountering problem with value binding it is not working for a h:inputText with rendered condition even when the rendered condition evaluates to true & the component is rendered.While trying to retrieve the value of the components with conditional rendering on submit i'm unable to retreive the value while on removing rendered condition the value binding is working perfectly
    <h:selectOneMenu id="DropDown" value="#pc_GeneralRequestInfo.objInfoDTO.State}" rendered="#pc_GeneralRequestInfo.objAddressRequestDetailsDTO.selectedAddressType == 'HOME'}">                    
    <f:selectItems value="#{pc_GeneralRequestInfo.statesList}" />
    </h:selectOneMenu>

    There is a { missing from the value attribute in the code you posted.                                                                                                                                                                                           

  • AutoPopulating a field with a string plus value from another field

    Hi: I have a table with two fields
    create table LINKREQUEST (
    requestid int primary key,
    INCIDENT_NUMBER varchar2(16),
    REQUESTID is auto populated using a sequence. I want to auto populate the INCIDENT field with the string "INC" plus the value from REQUESTID. Can someone help.
    TIA
    Ravi

    REQUESTID is auto populated using a sequence. I want to auto populate the INCIDENT field with the string "INC" plus the value from REQUESTIDSomething like this?:
    SQL> create table linkrequest (
    requestid int primary key,
    incident_number varchar2(16)
    Table created.
    SQL> create sequence linkrequest_seq
    Sequence created.
    SQL> create or replace trigger linkrequest_trg before insert on linkrequest
    for each row
    begin
    select linkrequest_seq.nextval,
            case when :new.incident_number = 'INC' then 'INC' || linkrequest_seq.nextval else :new.incident_number end
       into :new.requestid, :new.incident_number from dual;
    end;
    Trigger created.
    SQL> insert into  linkrequest (incident_number) values ('XY')
    1 row created.
    SQL> insert into  linkrequest (incident_number) values ('INC')
    1 row created.
    SQL> insert into  linkrequest (incident_number) values ('VW')
    1 row created.
    SQL> insert into  linkrequest (incident_number) values ('INC')
    1 row created.
    SQL> select * from linkrequest
    REQUESTID INCIDENT_NUMBER
             1 XY             
             2 INC2           
             3 VW             
             4 INC4           
    4 rows selected.

  • Forms.INS(72) No String value associated with this variable

    When I try to distribute my application I need to make sure that
    when my app installs it either adds or creates the environment
    variable Forms60_Path. This can be done in the project
    builder. When going through this one of the steps you have
    ability to add new environment variables. So I add on one named
    Forms60_Path with a value and contents of %PROD_HOME% and with
    the append set to yes.
    This now will give me either one or two errors when installing
    the application. The first error is that because i am choosing
    append set to yes it doesn't appear to be checking if the
    variable is already there or not. What it does do is give me a
    messages saying "A file not found while trying to translate
    Forms60_Path from '$Oracle' would u like to retry, ignore or
    process' I have choosen to process and the installer correctly
    adds the registry entry. That is a good thing but i still
    should not recieve an error when doing this it should check to
    see if the Reg entry is there if not then create it, if it is
    there then append to it. This only happens if you have append
    set to yes and the environment variable does not exist in the
    registry yet.
    The second error is more concerning because it just cancels out
    of the install all together. What it does no matter what under
    any circurmstance after you have added an environment variable
    in the delivery wizard is give u a message saying that
    "Form_Name.INS(72) No String Value associated with this
    variable" This error always comes up no matter what. After
    looking throught the INS file I took out the line
    "win32_register_map_variable(repl_var);" and I no longer
    recieved that error. My question is why do I get this error and
    what is the ramifications of taking this line out of the INS
    file?
    If no one else has had these problems I will be simply amazed!!!
    Thanks,
    Spencer Tabbert
    null

    Spencer,
    I am also getting the error you got months ago. (The second one: FORM.ins(72): No string value associated with this variable.) Can you tell me how you were able
    to fix it? I would appreciate it.
    I am new to Project Builder and pretty
    confused.
    Thanks,
    Monika

  • UISelectMany - Conversion error with HashMap Property

    Hi,
    I have a Backing Bean with a HashMap Property.
    public HashMap getItem()
    public void setItem(HashMap map)
    so I bind a Value of an UIInputText Component like that:
    <h:inputText id="txtname" value="#{MyBean.item['myKey']}" />
    this works pretty well.
    But when I try to do the same with an <h:selectManyCheckbox> Component I got a "Conversion Error".
    For what reason? I expected an Array or List Object.
    Thanks for help
    Ralph

    I solved the problem by creating a custom converter, which checks if the current valueBinding is null.
    If so, it replace the valueBinding with an empty ArrayList().
    public class MultiValueConverter implements Converter {
         public final static String CONVERTER_ID = "org.imixs.workflow.j2ee.faces.MultiValueConverter";
         public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException {
    // no changes
    return value;
         public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException {
    // Check if current value Binding is bind to an null-Object
    javax.faces.el.ValueBinding valueBinding=component.getValueBinding("value");
    if (valueBinding!=null && valueBinding.getValue(context)==null) {
    // replace binding with empty ArrayList
    valueBinding.setValue(context,new ArrayList());
    // no changes
    return value.toString();
    you can find the full code under www.imixs.org (an open source project for a EJB based workflow engine)

  • How to use Multimaps (Map String, ArrayList String )

    I was using an array to store player names, userIDs, uniqueIDs, and frag counts, but after reading about multimaps in the tutorials, it seems that would be much more efficient. However, I guess I don't quite understand it. Here's how I wanted things stored in my string array:
    String[] connectedUsers = {"user1_name", "user1_userid", "user1_uniqueid", "user1_frags"
                                            "user2_name"...}and here is how I'm attempting to setup and use the 'multimap':
    public class Main {
        static Map<String, ArrayList<String>> connectedUsers;
        public void updatePlayers(String name, String status) {
            String[] statusSplit = status.split(" ");
            if (connectedUsers.containsKey(name)) {
                connectedUsers.put(name, statusSplit[0]);
            else {
                connectedUsers.put(name, statusSplit[0]);
        }It's quite obvious I don't understand how this works, but should I even set this multimap up this way? Perhaps I should use a regular map with a string array for the values?

    You're cool MrOldie. Its just that alarm bells start ringing in my head when people come on and post as much as you do.
    * Created on Jul 28, 2005 by @author Tom Jacobs
    package tjacobs;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.Map;
    import java.util.Set;
    import java.util.TreeSet;
    * ManyMap is a map that allows more than one value to be stored with any key
    * <p>
    * There are a number of methods in the class that have been deprecated because
    * the original functionality of Map has been violated to accomodate the concept
    * of the ManyMap
    public class ManyMap<T, T2> implements Map<T, T2> {
         private HashMap<T, ArrayList<T2>> mInnerMap;
         public ManyMap() {
              mInnerMap = new HashMap<T, ArrayList<T2>>();
          * @deprecated
         public T2 get(Object obj) {
              ArrayList<T2> ar = _get(obj);
              if (ar == null || ar.size() == 0) {
                   return null;
              return ar.get(0);
         public Iterator<T2> getAll(Object obj) {
              ArrayList<T2> ar = _get(obj);
              if (ar == null || ar.size() == 0) {
                   return null;
              return ar.iterator();          
         public T2 put(T obj1, T2 obj2) {
              ArrayList<T2> ar = _getNotNull(obj1);
              ar.add(obj2);
              return obj2;
         public Set<Map.Entry<T, T2>> entrySet() {
              TreeSet<Map.Entry<T, T2>> entries = new TreeSet<Map.Entry<T, T2>>();
              Iterator<T> _i = mInnerMap.keySet().iterator();
              while (_i.hasNext()) {
                   T key = _i.next();
                   Iterator<T2> vals = mInnerMap.get(key).iterator();
                   while (vals.hasNext()) {
                        Entry<T, T2> entry = new Entry<T, T2>(key, vals.next());
                        entries.add(entry);
              return entries;
         public int size() {
              return mInnerMap.size();
         public int valuesSize() {
              int vals = 0;
              Iterator<T> _i = mInnerMap.keySet().iterator();
              while (_i.hasNext()) {
                   T key = _i.next();
                   ArrayList<T2> ar = mInnerMap.get(key);
                   vals += ar.size();
              return vals;
         public void clear() {
              mInnerMap.clear();
         public void putAll(Map<? extends T, ? extends T2> map) {
              Iterator _i = map.entrySet().iterator();
              while(_i.hasNext()) {
                   Map.Entry<? extends T, ? extends T2> entry = (Map.Entry<? extends T, ? extends T2>) _i.next();
                   put(entry.getKey(), entry.getValue());
         public Collection <T2> values() {
              LinkedList ll = new LinkedList();
              Iterator<ArrayList<T2>> _i = mInnerMap.values().iterator();
              while (_i.hasNext()) {
                   ll.addAll(_i.next());
              return ll;
         public boolean containsValue(Object val) {
              Iterator<ArrayList<T2>> values = mInnerMap.values().iterator();
              while (values.hasNext()) {
                   if (values.next().contains(val)) return true;
              return false;
         public boolean containsKey(Object key) {
              return mInnerMap.containsKey(key);
         public T2 remove(Object obj) {
              Iterator<ArrayList<T2>> values = mInnerMap.values().iterator();
              boolean found = false;
              while (values.hasNext()) {
                   if (values.next().remove(obj)) {
                        found = true;
              return found ? (T2)obj : null;
         public boolean isEmpty() {
              return valuesSize() == 0;
         @SuppressWarnings("hiding")
         private class Entry<T, T2> implements Map.Entry<T, T2> {
              T key;
              T2 val;
              public Entry (T obj1, T2 obj2) {
                   key = obj1;
                   val = obj2;
              public T2 getValue() {
                   return val;
              public T getKey() {
                   return key;
              public T2 setValue(T2 obj) {
                   return val = obj;
         public Set<T> keySet() {
              return mInnerMap.keySet();
         public ArrayList<T2> _get (Object obj) {
              return mInnerMap.get(obj);
         public ArrayList<T2> _getNotNull (T obj) {
              ArrayList<T2> list = _get(obj);
              if (list == null) {
                   list = new ArrayList<T2>(1);
                   mInnerMap.put(obj, list);
              return list;
    }Edited by: tjacobs01 on Aug 19, 2008 12:28 PM

Maybe you are looking for

  • Best way to get good resolution when hooking up to a TV?

    I've just recently bought a Macbook Pro 13" from the refurb store, and yesterday acquired a mini DVI to HDMI adapter, in order to hook it up to the TV (32" Samsung full Hd LCD).  It was successful enough, but the on screen view was hideous.  At first

  • ITunes producer error ITMS 9000

    I receive this error message but don't know how to decipher it or correct the problem. It seems to refer to a small image that I have long-since deleted. Help? ERROR ITMS-9000: "File : /OPS/assets/images/ClickHandler.ashxruhttp3a2f2fus.123rf.com2f400

  • Song sequence in iTunes all wrong

    Hello, I've been using iTunes for years and never had any problems, until now. Since last week iTunes shows all the songs in my library in alphabetic order. This is the case with downloaded stuff, but also with imported songs from a cd. I have tried

  • How to attach a file in this forum for refrence

    Hi , As part of  my earlier request in https://community.oracle.com/thread/3649392 I would like to attach a sample  sbconfig.jar as reference to others to recreate my issues. I noticed , don't have permission to attach the file. Any help is appreciat

  • Duplicate e-mails for same request

    Hi all, The user  is getting almost 30 repeated e-mails for the same access approval in the GRC landscape? I am not sure about how the e-mail thing works in the GRC landscape? could someonw throw more light here and let me know hw i could stop this r