BootsFaces-OSP: b:selectMultiMenu returns a wrong String if using selectItems

Hi, I got a problem that I try to solve for days now and I hope someone can help me.

Whenever I select multiple rows from a list or set, the string that comes back does not save all selected rows. For example, if I should get 1, 2, 3, 4 back as a string, I get 1, 2, 3 back and if I actually get 1,2,… 10, I get 1, 2, 3, 4, 6,…10 back (the 5 is missing). It varies constantly. But if I enter my list or set line by line using selectItem, everything works correctly using itemValue.

Part of my code:

<b:selectMultiMenu value="#{registrierenManagedBean.selectedSprachenString}">
      <f:selectItems value="#{registrierenManagedBean.allSprachenIDList}"/>

In my case it is about registering a user and selecting languages from a selectMultiMenu, which the user can speak and later edit the selection again. After registration, the user is stored in a database, where it becomes apparent that something is missing.

I hope I could make my problem clear.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21

Most upvoted comments

Brian Goetz recently gave a nice talk about the topic. Sure, getters and setters are about encapsulation, but why do you want to encapsulate anything? In this particular case, the attributes are explicitly exposed. The idea was to be able to modify the attribute without breaking the API. You can rename it, you can move it to another class, and so on.

Funny thing is nobody does that. Most people who’re refactoring their code modify the getters and setters, too. Modern IDEs make this a breeze. So in most programs getters and setter are just useless. Even the JVM optimizes them away. It’s a bit like installing security doors in your flat, between the kitchen and the living room.

Read-only and write-only attributes are another story. That’s a valid use-case.

Also read https://beyondjava.net/combining-object-oriented-programming-and-functional-programming (and maybe there’s a recording of Brian’s speech somewhere out there?).