Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSF
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSF
javax.el.PropertyNotFoundException
wadhah jebri
Greenhorn
Posts: 1
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello every body i would like to register User with roles this is my entities :
package org.domain.seam.entity; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.GeneratedValue; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.validator.Length; import org.hibernate.validator.NotNull; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.security.management.UserRoles; @Entity @Name("user") @Table(name = "User") public class User implements Serializable { /** * */ private static final long serialVersionUID = -2133760147013842042L; private Long id; private String name; private String password; private String username; private Set<Role> roles = new HashSet<Role>(); @Id @GeneratedValue public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Length(max = 20) @NotNull public String getName() { return name; } public void setName(String name) { this.name = name; } @Length(max = 20) @NotNull public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Length(max = 20) @NotNull public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @ManyToMany(targetEntity = Role.class) @UserRoles @JoinTable(name = "UsersRoles", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id")) public Set<Role> getRoles() { return roles; } public void setRoles(Set<Role> roles) { this.roles = roles; } }
package org.domain.seam.entity; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.GeneratedValue; import javax.persistence.Table; import org.hibernate.validator.Length; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.security.management.RoleName; @Name("role") @Entity @Table(name = "Role") public class Role implements Serializable { /** * */ private static final long serialVersionUID = 2392158972471437066L; private Long id; private String rolename; @Id @GeneratedValue public Long getId() { return id; } public void setId(Long id) { this.id = id; } @RoleName @Length(max = 20) public String getName() { return rolename; } public void setName(String rolename) { this.rolename = rolename; } }
This is my RegisterBean :
package org.domain.seam.session; import java.util.HashSet; import java.util.Set; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.domain.seam.entity.Role; import org.domain.seam.entity.User; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Logger; import org.jboss.seam.annotations.Scope; import org.jboss.seam.annotations.Transactional; import org.jboss.seam.log.Log; import org.jboss.seam.international.StatusMessages; @Stateless @Name("Register") @Scope(ScopeType.CONVERSATION) public class RegisterBean implements Register { @Logger private Log log; @In StatusMessages statusMessages; @In private User user; @PersistenceContext private EntityManager em; public Set<Role> selectedRoles = new HashSet<Role>(user.getRoles()); public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Set<Role> getSelectedRoles() { return selectedRoles; } public void setSelectedRoles(Set<Role> selectedRoles) { this.selectedRoles = selectedRoles; } @Transactional public String register() { // implement your business logic here // log.info("Register.register() action called"); // statusMessages.add("register"); user.setRoles(new HashSet<Role>(selectedRoles)); em.persist(user); return "/registered.xhtml"; } // add additional action methods }
this is my xhtml page :
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a="http://richfaces.org/a4j" template="layout/template.xhtml"> <ui:define name="body"> <rich:panel> <f:facet name="header">register</f:facet> <h:form id="RegisterForm"> <h:panelGrid columns="2"> Username: <h:inputText value="#{user.username}" required="true" /> Real Name: <h:inputText value="#{user.name}" required="true" /> Password: <h:inputSecret value="#{user.password}" required="true" /> </h:panelGrid> <h:panelGrid columns="2"> Roles: <h:selectManyCheckbox value="#{Register.selectedRoles}"> <f:selectItem itemLabel="Agent" itemValue="Agent " /> <f:selectItem itemLabel="Admin" itemValue="Admin " /> <s:convertEntity /> </h:selectManyCheckbox> </h:panelGrid> <h:commandButton id="register" value="register!" action="#{Register.register}" /> </h:form> </rich:panel> </ui:define> </ui:composition>
This is the error when i go to the register.xhtml
javax.el.PropertyNotFoundException: /register.xhtml @27,69 value="#{Register.selectedRoles}": Property 'selectedRoles' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_seam_2
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JBOSS Seam registration problem. Please help....
Cannot be cast to java.io.Serializable
selectManyListBox to add/remove user Roles
Problems with converter in h:selectManyCheckbox
@SqlResultSetMapping
More...