• Post Reply Bookmark Topic Watch Topic
  • New Topic

JBOSS Seam registration problem. Please help....  RSS feed

Benson Fung
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I followed the JBOSS Seam tutorial to develop registration seam application.
Unfortunately, I always got 3 'Conversion error' messages when I clicked the 'Register' button. There is no any error message in the console so I can't debug what is going on. I had been stuck to this problem for a long time. Please help. The followings are the files :

register.jsp :
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://jboss.com/products/seam/taglib" prefix="s" %>
<title>Register New User</title>
<table border="0">

<td><h:inputText value="#{user.username}"/></td>
<td>Real Name</td>
<td><h:inputText value="#{user.name}"/></td>

<td><h:inputSecret value="#{user.password}"/></td>


<h:commandButton type="submit" value="Register" action="#{register.register}"/>

web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"

<!-- Seam -->


<!-- MyFaces -->



<servlet-name>Faces Servlet</servlet-name>

<!-- Faces Servlet Mapping -->
<servlet-name>Faces Servlet</servlet-name>


faces-config.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config
PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
<!-- A phase listener is needed by all Seam applications -->



User.java :
package com.myseam.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.validator.NotNull;
import org.hibernate.validator.Length;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;

public class User implements Serializable
private static final long serialVersionUID = 1881413500711441951L;

private String username;
private String password;
private String name;

public User(String name, String password, String username)
this.name = name;
this.password = password;
this.username = username;

public User() { System.out.println("Creating user project.");}

@NotNull @Length(min=5, max=15)
public String getPassword()
return password;

public void setPassword(String password)
System.out.println("password=" + password);
this.password = password;

public String getName()
return name;

public void setName(String name)
System.out.println("name=" + name);
this.name = name;

@Id @NotNull @Length(min=5, max=15)
public String getUsername()
return username;

public void setUsername(String username)
System.out.println("username=" + username);
this.username = username;


package com.myseam.session;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.core.FacesMessages;
import org.jboss.seam.log.Log;

import com.myseam.entity.User;
import com.myseam.inf.Register;
import org.jboss.seam.annotations.Name;

@Stateless //(1)
public class RegisterAction implements Register

@In //(2)
private User user;

@PersistenceContext //(3)
private EntityManager em;

@Logger //(4)
private Log log;

public String register() // (5)
List existing = em.createQuery(
"select username from User where username=#{user.username}") //(6)

if (existing.size()==0)
log.info("Registered new user #{user.username}"); //(7)
return "/registered.jsp"; // (8)
FacesMessages.instance().add("User #{user.username} already exists"); // (9)
return null;


Please help
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!