Hi,
I'm using JBOSS 4.0.5GA, SEAM 1.1.0RC1 and SelectItems 1.1.1beta2.
I have a page to edit users properties, and one of theses fields is the user's
company (using si:selectItems). The list of companies show up perfectly, but
when I click "Ok" to save the user, in te validation phase I get the following
message:
"companies": Value is not a valid option.
Bellow is useredit.xhtml (part of it)
anonymous wrote : <h:selectOneMenu id="company" value="#{user.company}"
required="true">
| <si:selectItems value="#{companies}" var="co" label="#{co.name}"
noSelectionLabel="-" />
| </h:selectOneMenu>
| <h:message for="company" styleClass="erro" />
and userBean.java
anonymous wrote : @Stateful
| @Scope(value=ScopeType.CONVERSATION)
| @Name("users")
| public class UsersBean implements Users {
|
| @DataModel
| private List userList;
|
| @EJB
| private UsersSrv userSrv;
|
| @DataModelSelection
| @Out(required=false)
| private User user;
|
| @In(create=true)
| private EntityManager em;
|
| @SuppressWarnings("unchecked")
| @Factory("companies")
| public List createCompanyList() {
| return em.createQuery("from Company").getResultList();
| }
|
| @SuppressWarnings("unchecked")
| @Factory("userList")
| public void createUserList() {
| userList = em.createQuery("from User u join fetch
u.company").getResultList();
| }
|
| @Begin
| public String edit() {
| return "edit";
| }
|
| @Begin
| public String new() {
| user = new User();
| return "edit";
| }
|
| @End
| public String save() {
| if (user.getId() == null) {
| usuSrv.saveNewUser(user);
| }
| else em.persist(user);
|
| return "return";
| }
|
| @End
| public String cancel() {
| return "return";
| }
|
| @Remove @Destroy
| public void destroy() {
| }
| }
and User.java (just the beggining)
@Entity
| @Name("user")
| @SequenceGenerator(name="USER_SEQ")
| public class User implements java.io.Serializable {
|
| @Id @GeneratedValue(generator="USER_SEQ")
| private Integer id;
|
| @Column(nullable=false, length=20, unique=true)
| private String account;
|
| @Column(nullable=false, length=50)
| private String name;
|
| @ManyToOne
| @JoinColumn(name="COMPANY_ID")
| private Company company;
|
Any tip?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988414#3988414
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988414
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user