rendered problems in the form
finalspirit Sep 28, 2010 5:32 PMHello,
In first, sorry for my bad english.
I create a new Seam project. I generate the entities from the database with 2 table (users and groups). In a user, we can found a list of group.
Entity Users :
Session userSelected
package com.adecco.esb.supervision.session.main; import java.io.Serializable; import javax.persistence.EntityManager; import javax.persistence.Query; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.faces.FacesMessages; import com.adecco.esb.supervision.entity.Users; @Name("usersSelectedHelper") @Scope(ScopeType.CONVERSATION) public class UsersSelectedHelper implements Serializable { private static final long serialVersionUID = 1L; @In(create = true) EntityManager entityManager; @In(required = true) Users loggedUser; @In FacesMessages facesMessages; private Users selectedUsers; private boolean editUsers; private boolean addUsers; /** * @return the selectedUsers */ public Users getSelectedUsers() { if (selectedUsers == null) { selectedUsers = new Users(); } return selectedUsers; } public void setSelectedusersId(long id) { String queryString; queryString = "SELECT u FROM Users u WHERE u.idusers=:iduser"; // Creating the query Query query = entityManager.createQuery(queryString).setParameter( "iduser", id); // Getting the contacts list selectedUsers = (Users) query.getSingleResult(); } /** * @param selectedUsers * the selectedUsers to set */ public void setSelectedUsers(Users selectedUsers) { this.selectedUsers = selectedUsers; } /** * @return the editUsers */ public boolean isEditUsers() { return editUsers; } /** * @param editUsers * the editUsers to set */ public void setEditUsers(boolean editUsers) { this.editUsers = editUsers; } public void createNewEmptyUserInstance() { setSelectedUsers(new Users()); } public void insertNewUser() { entityManager.persist(getSelectedUsers()); entityManager.flush(); // De-selecting the current contact setSelectedUsers(null); setEditUsers(false); } public void saveContactData() { entityManager.merge(getSelectedUsers()); entityManager.flush(); // De-selecting the current contact setSelectedUsers(null); setEditUsers(false); } public void deleteSelectedContact() { entityManager.remove(getSelectedUsers()); entityManager.flush(); // De-selecting the current contact setSelectedUsers(null); setEditUsers(false); } public boolean isSelectedUserManaged() { return getSelectedUsers() != null && entityManager.contains(getSelectedUsers()); } /** * @return the addUsers */ public boolean isAddUsers() { return addUsers; } /** * @param addUsers * the addUsers to set */ public void setAddUsers(boolean addUsers) { this.addUsers = addUsers; } }
to finish the xhtml
In edit.xhtml and add.xhtml, we have a simple form
My problem is very simple :
If i set the rendered property
When the form appear (click on edit link in the table), all input are correctly feed (blank for add and pre fed for edit). When i click on the button to save the user, nothing happens... it's the same for the edit form.
If i remove the property rendered, the two forms always appear in the page but if i click on the add button or edit button, the user are add and the table is refresh.
What the problem in the first case (rendered property set) ?
Thanks