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

kvchowdary_6699 do-not-reply at jboss.com
Mon May 21 07:10:07 EDT 2007


hi 
when i click submit button in jspx page i got this error.

i ran the application like registration.


  | 
  | application.jspx
  | 
  | <?xml version="1.0"?>
  | <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" 
  |           xmlns:h="http://java.sun.com/jsf/html"
  |           xmlns:f="http://java.sun.com/jsf/core"
  |           xmlns:s="http://jboss.com/products/seam/taglib"
  |           xmlns="http://www.w3.org/1999/xhtml"
  |           version="2.0">
  |   <jsp:output doctype-root-element="html"
  |               doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
  |               doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
  |   <jsp:directive.page contentType="text/html"/>
  |   <html>
  |   <head>
  |     <title>Application New User</title>
  |   </head>
  |   <body>
  | 	 <f:view>
  |       <h:form>
  |         <table border="0">
  |          <s:validateAll>
  |             <tr>
  |               <td>Application ID</td>
  |               <td><h:inputText value="#{app.appID}" required="true"/></td>
  |             </tr>
  |             <tr>
  |               <td>First Name</td>
  |               <td><h:inputText value="#{app.firstName}" required="true"/></td>
  |             </tr>
  |             <tr>
  |               <td>Last Name</td>
  |               <td><h:inputText value="#{app.lastName}" required="true"/></td>
  |             </tr>
  |             <tr>
  |               <td>SEX</td>
  |               <td><h:inputText value="#{app.sex}" required="true"/></td>
  |             </tr>
  |             <tr>
  |               <td>AGE</td>
  |               <td><h:inputText value="#{app.age}" required="true"/></td>
  |             </tr>
  |           </s:validateAll>
  |         </table>
  |         <h:messages/>
  |         <h:commandButton value="Approve" action="#{application.application}"/>
  |       </h:form>
  |     </f:view>
  |   </body>
  |   </html>
  | </jsp:root>
  | 
  | 
  | ApplicationUser.java 
  | 
  | 
  | package org.jboss.seam.example.application;
  | 
  | 	import java.io.Serializable;
  | 	import javax.persistence.Entity;
  | 	import javax.persistence.Id;
  | 	import javax.persistence.Table;
  | 
  | 	import org.hibernate.validator.Length;
  | 	import org.hibernate.validator.NotNull;
  | 	import org.jboss.seam.ScopeType;
  | 	import org.jboss.seam.annotations.Name;
  | 	import org.jboss.seam.annotations.Scope;
  | 
  | 	@Entity
  | 	@Name("app")
  | 	@Scope(ScopeType.SESSION)
  | 	@Table(name="applications")
  | 
  | 	public class ApplicationUser implements Serializable
  | 	{
  | 		private int appID;
  | 		private String firstName;
  | 		private String lastName;
  | 		private String sex;
  | 		private int age;
  | 		
  | 		public ApplicationUser(int appID, String firstName, String lastName, String sex, int age)
  | 		{
  | 			this.appID = appID;
  | 			this.firstName = firstName;
  | 			this.lastName = lastName;
  | 			this.sex = sex;
  | 			this.age = age;
  | 		}
  | 		
  | 		public ApplicationUser(){}
  | 
  | 		//@NotNull @Length(min=1, max=2)
  | 		public int getAge() {
  | 			return age;
  | 		}
  | 
  | 		public void setAge(int age) {
  | 			this.age = age;
  | 		}
  | 
  | 		//@Id @NotNull @Length(min=3, max=5)	
  | 		public int getAppID() {
  | 			return appID;
  | 		}
  | 
  | 		public void setAppID(int appID) {
  | 			this.appID = appID;
  | 		}
  | 
  | 		//@NotNull @Length(min=5, max=15)
  | 		public String getFirstName() {
  | 			return firstName;
  | 		}
  | 
  | 		public void setFirstName(String firstName) {
  | 			this.firstName = firstName;
  | 		}
  | 
  | 	//	@NotNull @Length(min=5, max=15)
  | 		public String getLastName() {
  | 			return lastName;
  | 		}
  | 
  | 		public void setLastName(String lastName) {
  | 			this.lastName = lastName;
  | 		}
  | 		
  | 		//@NotNull @Length(min=4, max=6)
  | 		public String getSex() {
  | 			return sex;
  | 		}
  | 
  | 		public void setSex(String sex) {
  | 			this.sex = sex;
  | 		}
  | 	}
  | 
  | 
  | 
  | and ApplicationAction.java
  | 
  | 
  | package org.jboss.seam.example.application;
  | 
  | import java.util.List;
  | 
  | import javax.ejb.Stateless;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | 
  | import org.apache.commons.logging.Log;
  | import org.jboss.seam.annotations.In;
  | import org.jboss.seam.annotations.Logger;
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.core.FacesMessages;
  | 
  | @Stateless
  | @Name("application")
  | public class ApplicationAction implements Application
  | {
  | 	@In
  | 	private ApplicationUser app;
  | 	
  | 	@PersistenceContext
  | 	private EntityManager em;
  | 	
  | 	@Logger
  | 	private Log log;
  | 
  | 	public String application() {
  | 		List existing=em.createQuery("select appID from ApplicationUser where appID=#(app.appID)").getResultList();
  | 		if(existing.size()==0){
  | 			em.persist(app);
  | 			log.debug("#(ApplicationUser.appID) approved sucessfully");
  | 			return "/appApproved.jspx";
  | 		}
  | 		else{
  | 			FacesMessages.instance().add("#(ApplicationUser.appID) approved already");
  | 			return null;
  | 		}
  | 	}
  | 
  | 	
  | 	
  | 	
  | }
  | 
  | 
  | 
  | could you suggest me?
  | 
  | 
  | 
  | 

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

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



More information about the jboss-user mailing list