I am currently experiencing a few problems with submitting form data. I must be missing
something some where.
I am using Seam 2.0 BETA 1, JBoss AS 4.2 and Kubuntu 64
The problem is that I am getting the following errors when I submit the form. The action
to display a simple list of users works correctly using the name provided to seam. Did I
miss something when setting up my class methods?
Jboss Errors:
| Caused by: javax.ejb.EJBTransactionRolledbackException: Could not get property
value...
|
| Caused by: java.lang.IllegalArgumentException: Invoking setPassword with wrong
parameters...
|
I have setup the entity as follows
| import ...
|
| @Entity
| @Table(name = "Users")
| @Name("user")
| public class UserImpl implements User
| {...
|
Here is the setPassword method
| @NotNull
| @Length(min=3, max=15)
| public void setPassword(String password)
| {
| this.password = password;
| }
|
I have a simple form...
| <!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.ajax4jsf.org/rich"
| template="/layout/template.xhtml">
|
| <ui:define name="body">
| <h:form>
| <table border="0">
|
| <tr>
| <td>Username</td>
| <td><h:inputText
value="#{user.userName}"/></td>
| </tr>
| <tr>
| <td>First Name</td>
| <td><h:inputText
value="#{user.firstName}"/></td>
| </tr>
| <tr>
| <td>Last Name</td>
| <td><h:inputText
value="#{user.lastName}"/></td>
| </tr>
|
| <tr>
| <td>Password</td>
| <td><h:inputSecret
value="#{user.password}"/></td>
| </tr>
|
| </table>
| <h:commandButton type="submit" value="Add User"
action="#{useraction.addUser}"/>
| </h:form>
|
| </ui:define>
| </ui:composition>
|
The addUser method in the UserActionImpl class
| public String addUser()
| {
|
| em.persist(user);
|
| List existing = em.createQuery("select userName from UserImpl where
userName=:userName").setParameter("userName",
user.getUserName()).getResultList();
|
| if (existing.size()==0)
| {
| em.persist(user);
| //log.info("Registered new user #{user.username}");
| return "/admin/user/userlist.xhtml";
| }
| else
| {
| FacesMessages.instance().add("User #{user.userName} already
exists");
| return null;
| }
| }
|
I think I have everything setup correctly. Nothing fancy going on here just working
through the basics.
Any assistance would be most appreciated.
Thank you,
John
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064095#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...