Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate 在JSF1.2+;接缝_Hibernate_Jsf_Jpa_Jboss_Seam - Fatal编程技术网

Hibernate 在JSF1.2+;接缝

Hibernate 在JSF1.2+;接缝,hibernate,jsf,jpa,jboss,seam,Hibernate,Jsf,Jpa,Jboss,Seam,我正在尝试在我的用户列表页面中按名字进行搜索。在将搜索选项放入用户列表页面之前,用户列表页面工作正常。 在我在list.xhtml中添加了用于搜索的代码后,页面显示以下错误, 请求处理期间出现异常: 由javax.servlet.ServletException引起,消息为:“/secure/admin/user/customer/customerList.xhtml@70,70 value=“#{userByFirstNameAction.firstName}”:在org.javassist.

我正在尝试在我的用户列表页面中按名字进行搜索。在将搜索选项放入用户列表页面之前,用户列表页面工作正常。 在我在list.xhtml中添加了用于搜索的代码后,页面显示以下错误, 请求处理期间出现异常: 由javax.servlet.ServletException引起,消息为:“/secure/admin/user/customer/customerList.xhtml@70,70 value=“#{userByFirstNameAction.firstName}”:在org.javassist.tmp.java.lang.Object\u$$\ uJavassist\uSeam\u25类型上未找到属性“firstName”

我的列表页面是:customerList.xhtml

    <h:form class="input-list" id="searchUser" style="width:100%;"
        name="searchUser">
        <div class="search_button">
            SEARCH BY FIRST NAME :
            <h:inputText tabindex="1" id="firstName" type="text"
                value="#{userByFirstNameAction.firstName}" required="true">
                <f:validateLength minimum="3" maximum="20" />
            </h:inputText>
        </div>

        <h:commandButton value="Search" tabindex="2"
            action="#{userByFirstNameAction.retrieveCustomersByFirstName}">
        </h:commandButton>
    </h:form>

按名字搜索:
userByFirstNameAction.java:

    @Name("userByFirstNameAction")
    @Stateless
    @AutoCreate
    public class UserByFirstNameActionImpl implements UserByFirstNameAction {


        private UserTypeEnum userType;

        @In
        private UserService userService;

        //@In(value = "firstName", scope = ScopeType.CONVERSATION, required = false)
        private String firstName;

        /**
         * 
         */
        private static final long serialVersionUID = 8282995226262125676L;


        public String getFirstName() {
            return firstName;
        }

        public void setFirstName(String firstName) {
            this.firstName = firstName;
        }

            @Override
        public List<User> retrieveCustomersByFirstName(String firstName) {
            //this.userType = UserTypeEnum.CUSTOMER;
            return userService.findByFirst(firstName);      
        }

    }
@Name(“userByFirstNameAction”)
@无国籍
@自动创建
公共类UserByFirstNameActionImpl实现UserByFirstNameAction{
私有用户类型枚举用户类型;
@在
私人用户服务;
//@在(value=“firstName”,scope=ScopeType.CONVERSATION,required=false)中
私有字符串名;
/**
* 
*/
私有静态最终长serialVersionUID=8282995226262125676L;
公共字符串getFirstName(){
返回名字;
}
public void setFirstName(字符串firstName){
this.firstName=firstName;
}
@凌驾
公共列表检索CustomersByFirstName(字符串名){
//this.userType=UserTypeEnum.CUSTOMER;
返回userService.findByFirst(firstName);
}
}
@简:谢谢你抽出时间

我已经在bean类中为firstname设置了Get/Set

这里供你参考

接口:

    package com.ermms.clrp.user;

    import java.io.Serializable;
    import java.util.List;

    import javax.ejb.Local;

    import com.ermms.clrp.dto.user.CLRPUser;
    import com.ermms.clrp.dto.user.User;




    @Local
    public interface UserByFirstNameAction extends Serializable {

        public String initEmployee();

        public String initCustomer();

        public List<User> getEmployeesByFirstName();

        public List<User> getCustomersByFirstName();

        public List<User> retrieveEmployeesByFirstName();

        // public List<User> retrieveCustomersByFirstName();

        public List<User> retrieveCustomersByFirstName(String firstName);
    }
package com.ermms.clrp.user;
导入java.io.Serializable;
导入java.util.List;
导入javax.ejb.Local;
导入com.ermms.clrp.dto.user.CLRPUser;
导入com.ermms.clrp.dto.user.user;
@本地的
公共接口UserByFirstNameAction扩展了可序列化{
公共字符串initEmployee();
公共字符串initCustomer();
公共列表getEmployeesByFirstName();
公共列表GetCustomerByFirstName();
公共列表检索employeesbyfirstname();
//公共列表检索CustomersByFirstName();
公共列表检索CustomersByFirstName(字符串名);
}
类别:

    package com.ermms.clrp.user;

    import java.util.List;

    import javax.ejb.Stateless;

    import org.jboss.seam.ScopeType;
    import org.jboss.seam.annotations.AutoCreate;
    import org.jboss.seam.annotations.In;
    import org.jboss.seam.annotations.Name;
    import org.jboss.seam.annotations.Out;

    import com.ermms.clrp.common.enumeration.UserTypeEnum;
    import com.ermms.clrp.dto.user.CLRPUser;
    import com.ermms.clrp.dto.user.User;
    import com.ermms.clrp.service.UserService;



    @Name("userByFirstNameAction")
    @Stateless
    @AutoCreate
    public class UserByFirstNameActionImpl implements UserByFirstNameAction {


        private UserTypeEnum userType;

        @In
        private UserService userService;

        //@In(value = "firstName", scope = ScopeType.CONVERSATION, required = false)
        private String firstName;

        /**
         * 
         */
        private static final long serialVersionUID = 8282995226262125676L;


        public String getFirstName() {
            return firstName;
        }

        public void setFirstName(String firstName) {
            this.firstName = firstName;
        }

        @Override
        public List<User> getEmployeesByFirstName() {
            this.userType = UserTypeEnum.EMPLOYEE;
            return userService.findByFirstName(firstName, userType);
        }

        @Override
        public List<User> getCustomersByFirstName() {
            this.userType = UserTypeEnum.CUSTOMER;
            return userService.findByFirstName(firstName, userType);        
        }

        @Override
        public List<User> retrieveEmployeesByFirstName() {
            this.userType = UserTypeEnum.EMPLOYEE;
            return userService.findByFirstName(firstName, userType);
        }

        @Override
        public List<User> retrieveCustomersByFirstName(String firstName) {
            //this.userType = UserTypeEnum.CUSTOMER;
            return userService.findByFirst(firstName);      
        }

        public String initEmployee() {      
            return "/secure/admin/user/customer/customerListByFirstName.xhtml";
        }

        public String initCustomer() {
            this.userType = UserTypeEnum.CUSTOMER;
            return "/secure/admin/user/customer/customerListByFirstName.xhtml";
        }
        public UserTypeEnum getUserType() {
            return userType;
        }

        public void setUserType(UserTypeEnum userType) {
            this.userType = userType;
        }

    }
package com.ermms.clrp.user;
导入java.util.List;
导入javax.ejb.Stateless;
导入org.jboss.seam.ScopeType;
导入org.jboss.seam.annotations.AutoCreate;
导入org.jboss.seam.annotations.In;
导入org.jboss.seam.annotations.Name;
导入org.jboss.seam.annotations.Out;
导入com.ermms.clrp.common.enumeration.UserTypeEnum;
导入com.ermms.clrp.dto.user.CLRPUser;
导入com.ermms.clrp.dto.user.user;
导入com.ermms.clrp.service.UserService;
@名称(“userByFirstNameAction”)
@无国籍
@自动创建
公共类UserByFirstNameActionImpl实现UserByFirstNameAction{
私有用户类型枚举用户类型;
@在
私人用户服务;
//@在(value=“firstName”,scope=ScopeType.CONVERSATION,required=false)中
私有字符串名;
/**
* 
*/
私有静态最终长serialVersionUID=8282995226262125676L;
公共字符串getFirstName(){
返回名字;
}
public void setFirstName(字符串firstName){
this.firstName=firstName;
}
@凌驾
公共列表getEmployeesByFirstName(){
this.userType=UserTypeEnum.EMPLOYEE;
返回userService.findByFirstName(firstName,userType);
}
@凌驾
公共列表GetCustomerByFirstName(){
this.userType=UserTypeEnum.CUSTOMER;
返回userService.findByFirstName(firstName,userType);
}
@凌驾
公共列表检索EmployeesByFirstName(){
this.userType=UserTypeEnum.EMPLOYEE;
返回userService.findByFirstName(firstName,userType);
}
@凌驾
公共列表检索CustomersByFirstName(字符串名){
//this.userType=UserTypeEnum.CUSTOMER;
返回userService.findByFirst(firstName);
}
公共字符串initEmployee(){
return“/secure/admin/user/customer/customerListByFirstName.xhtml”;
}
公共字符串initCustomer(){
this.userType=UserTypeEnum.CUSTOMER;
return“/secure/admin/user/customer/customerListByFirstName.xhtml”;
}
公共用户类型枚举getUserType(){
返回用户类型;
}
公共void setUserType(UserTypeEnum userType){
this.userType=userType;
}
}

提前感谢

您是否将Setter/Getter添加到UserByFirstNameAction接口?好的,我使用SEAM 2.2已经有一段时间了,但我假设您使用@Name UserByFirstNameAction调用无状态会话Bean。这不仅仅是SEAM-POJO,而是EJB上下文中的SLSB。因此,调用转到SLSB本地接口UserByFirstNameAction。您仅在SLSB实现中声明了var firstName的getter/setter,而没有在本地IFace中声明。对于IDE中的SEAM验证器(以及EL本身),此时一切正常。但在运行时,您会得到上面的异常。解决方案是在接口中声明getter和setter。Jan,在我的UserByFirstNameAction接口中,我为firstName定义了get/set。。。。我做对了吗?此外,我还需要为接口中的任何内容添加更多的get/set?在本地IFace中定义getFirstName和setFirstName(字符串s)就足够了。Jan,Thakns谢谢您的帮助。。它的工作和错误得到了解决。。。如果我点击搜索按钮,它就会显示出来