[jboss-user] [JBoss Seam] - Conversion Error

koriel do-not-reply at jboss.com
Fri Aug 11 05:24:54 EDT 2006


My user entity


  | @Entity
  | @Table(name="USERS")
  | public abstract class User implements Serializable
  | {
  |  
  |    private String password;
  |    private List<Names> name;
  |    private long id;
  |    
  |    
  |    @Id
  |    @GeneratedValue
  |    public long getId() {
  | 	return id;
  | }
  | 
  | public void setId(long id) {
  | 	this.id = id;
  | }
  | 
  | public User(List<Names> name, String password)
  |    {
  |       this.name = name;
  |       this.password = password;
  |      
  |    }
  |    
  |    public User() {}
  | 
  | 
  |    
  |    @NotNull
  |    @Length(min=5, max=15, message="Password must be at least 5 characters")
  |    public String getPassword()
  |    {
  |       return password;
  |    }
  |    public void setPassword(String password)
  |    {
  |       this.password = password;
  |    }
  |    
  | 	@NotNull
  | 	@OneToMany
  | 	public List<Names> getName() {
  | 		return name;
  | 	}
  | 
  | 	public void setName(List<Names> name) {
  | 		this.name = name;
  | 	}
  |    
  |    
  |    public String toString() 
  |    {
  |       return "User(" + password + ")";
  |    }
  | }
  | 

my AuthorUser class 


  | @Entity
  | @DiscriminatorValue("AuthorUser")
  | @Scope(ScopeType.SESSION)
  | public class AuthorUser extends User implements Serializable {
  | 
  | 	public String gender;
  | 	public String title;
  | 
  | 	public AuthorUser() {}
  | 	
  | 
  | 	public String getGender() {
  | 		return gender;
  | 	}
  | 
  | 	public void setGender(String gender) {
  | 		this.gender = gender;
  | 	}
  | 
  | 	public String getTitle() {
  | 		return title;
  | 	}
  | 
  | 	public void setTitle(String title) {
  | 		this.title = title;
  | 	}
  | 
  | 
  | 
  | }
  | 

my registerAction class 

  | @Stateful
  | 
  | @Scope(ScopeType.SESSION)
  | 
  | @Name("register")
  | 
  | public class RegisterAction implements Register
  | 
  | {
  | 
  | 
  | 
  |    @In(create = true) 
  | 
  |    private AuthorUser authorUser;
  | 
  |    
  | 
  |    @In(create = true)
  | 
  |    private Names names;
  | 
  |    
  | 
  |    @Logger
  | 
  |    private Log log;
  | 
  |    
  | 
  |    @PersistenceContext
  | 
  |    private EntityManager em;
  | 
  |    
  | 
  |    @In(create=true)
  | 
  |    private transient FacesMessages facesMessages;
  | 
  |    
  | 
  |    private String verify;
  | 
  |    
  | 
  |    public String register()
  | 
  |    {
  | 
  | 	  
  | 
  | 	log.info("hi");
  |    }
  | }
  | 
  |  


and my xhtml page


  |   <h:form id="testForm">
  |   
  |   <table border="0">
  | 				<s:validateAll>
  | 					
  | 					
  | 					
  | 					<tr>
  | 						<td>Lastname</td>
  | 						<td><h:inputText value="#{names.lastname}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Firstname</td>
  | 						<td><h:inputText value="#{names.firstname}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Middlename</td>
  | 						<td><h:inputText value="#{names.middlename}" /></td>
  | 					</tr>  
  | 					
  | 					
  | 					<tr>
  | 						<td>Gender</td>
  | 						<td><h:inputText value="#{authorUser.gender}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Title</td>
  | 						<td><h:inputText value="#{authorUser.title}" /></td>
  | 					</tr> 
  | 					<tr>
  | 						<td>Password</td>
  | 						<td><h:inputText value="#{authorUser.password}" /></td>
  | 					</tr> 
  | 
  | 
  | <tr>
  | 					<td></td>
  | 					<td><h:commandButton value="Submit" action="#{register.register}"  /></td>
  | 				     </tr>
  | 						</s:validateAll>
  | 						<h:messages />
  | 				</table>
  | 						
  | 			 </h:form>
  | 
  | 

By submiting the form I get conversion error for authorUser.title,gender and password..

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964561#3964561

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964561



More information about the jboss-user mailing list