[jboss-user] [JBoss Seam] - Problem with forms

koriel do-not-reply at jboss.com
Tue Aug 8 11:44:12 EDT 2006


I have two entity classes users and names with a onetomany relation...the problem is that when I have this names entity in my form when I hit submit nothing happens. If I have only the users in my form everything goes well. The submit action calls the registerUser.register method...anyone can explain me what am I doing wrong..?There is no error messages in jboss btw..

my register.xhtml page

  | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  |                       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  | <html xmlns="http://www.w3.org/1999/xhtml"
  |       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:s="http://jboss.com/products/seam/taglib">
  | <body>
  | 
  | 
  | this text won't be displayed
  | 
  | <ui:composition template="extras/template.xhtml">
  | <ui:define name="title">
  |  Registration Form
  | </ui:define>
  | 
  | 
  | <ui:define name="body">
  |   <h:form id="testForm">
  |   
  |     <table border="0">
  | 				<s:validateAll>
  | 					
  | 					
  | 				
  | 					 
  | 					<tr>
  | 						<td>Surname</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="#{author.gender}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Title</td>
  | 						<td><h:inputText value="#{author.title}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Year Of Birth</td>
  | 						<td><h:inputText value="#{author.yearOfBirth}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>url</td>
  | 						<td><h:inputText value="#{author.url}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>email</td>
  | 						<td><h:inputText value="#{author.email}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>keywords</td>
  | 						<td><h:inputText value="#{author.keywords}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Password</td>
  | 						<td><h:inputText value="#{author.password}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Retype Password</td>
  | 						<td><h:inputText value="#{author.retypePassword}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Secret Question</td>
  | 						<td><h:inputText value="#{author.secretQuestion}" /></td>
  | 					</tr>
  | 					<tr>
  | 						<td>Secret Answer</td>
  | 						<td><h:inputText value="#{author.secretAnswer}" /></td>
  | 					</tr> -->
  | 				
  | 					<tr>
  | 						<td></td>
  | 						<td><h:commandButton type="Submit" value="Submit" action="#{registerAuthor.register}"  /></td>
  | 					</tr>
  | 						</s:validateAll>
  | 				</table>
  | 			
  |   </h:form>
  |   
  | 				 
  | 				  
  | </ui:define>		
  | 
  | </ui:composition>		
  | 		
  | </body>
  | </html>
  | 


my ejb class

  | package uai.entities;
  | 
  | import java.io.Serializable;
  | 
  | import javax.persistence.Entity;
  | import javax.persistence.GeneratedValue;
  | import javax.persistence.Id;
  | import javax.persistence.JoinColumn;
  | import javax.persistence.ManyToOne;
  | import javax.persistence.Table;
  | 
  | import org.hibernate.validator.NotNull;
  | import org.jboss.seam.ScopeType;
  | import org.jboss.seam.annotations.Scope;
  | 
  | 
  | @Entity
  | @Table(name="names")
  | @Scope(ScopeType.CONVERSATION)
  | public class AuthorName implements Serializable {
  | 
  | 	/**
  | 	 * 
  | 	 */
  | 	private static final long serialVersionUID = 7854278207664893998L;
  | 	private String lastname;
  | 	private String firstname;
  | 	private String middlename;
  | 	private Long id;
  | 	
  | 	
  | 	@Id
  | 	@GeneratedValue
  | 	public Long getId() {
  | 		return id;
  | 	}
  | 	
  | 	public void setId(Long id) {
  | 		this.id = id;
  | 	}
  | 	
  | 	
  | 	public String getMiddlename() {
  | 		return middlename;
  | 	}
  | 	public void setMiddlename(String middlename) {
  | 		this.middlename = middlename;
  | 	}
  | 	
  | 	@NotNull
  | 	public String getFirstname() {
  | 		return firstname;
  | 	}
  | 	public void setFirstname(String name) {
  | 		this.firstname = name;
  | 	}
  | 	
  | 	@NotNull
  | 	public String getLastname() {
  | 		return lastname;
  | 	}
  | 	public void setLastname(String surname) {
  | 		this.lastname = surname;
  | 	}
  | 	
  | 	
  | 
  | 	
  | 	
  | 	
  | }
  | 

and my registerAuthor class 


  | package uai.blogic;
  | 
  | import javax.ejb.Remove;
  | import javax.ejb.Stateful;
  | import javax.interceptor.Interceptors;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | 
  | import org.jboss.seam.annotations.Create;
  | import org.jboss.seam.annotations.Destroy;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.annotations.Out;
  | import org.jboss.seam.annotations.Scope;
  | import org.jboss.seam.core.FacesMessages;
  | import org.jboss.seam.ejb.SeamInterceptor;
  | import org.jboss.seam.log.Log;
  | 
  | import uai.entities.AuthorName;
  | import uai.entities.testObject;
  | import static org.jboss.seam.ScopeType.EVENT;
  | 
  | @Interceptors(SeamInterceptor.class)
  | @Stateful
  | @Name("registerAuthor")
  | public class RegisterAuthor implements Register {
  | 
  | 	@Logger
  | 	private Log log;
  | 	
  | 
  | 	
  | 	@In(create=true)
  | 	private transient FacesMessages facesMessages;
  | 	
  | 
  | 	
  | 	@In @Out
  |     private AuthorName authorName;
  | 
  | 	//@In @Out
  | 	//private uai.entities.AuthorUser author;
  | 	
  | 	@PersistenceContext
  | 	private EntityManager em;
  | 
  | 	public String register() {
  | 		
  |          
  | 		log.info("hi there");
  | 		
  | 		//log.info("authorname : "+this.author.getEmail());
  | 		
  | 		return "/registered.xhtml";
  | 	}
  | 
  | 	@Destroy
  | 	@Remove
  | 	public void destroy() {
  | 		//log.info("destroyed (register)");
  | 
  | 	}
  | 	
  | 
  | 
  | 
  | }
  | 

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

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



More information about the jboss-user mailing list