2

我使用 JBOSS AS-7.1.1 Final 和 Seam 3.1.0 Final 开发 Web 应用程序。我刚开始工作,但遇到以下问题:我有一个带有以下代码的提交按钮:

    <h:commandButton action="#{projectController.create}" value="Create Project" styleClass="greyishBtn submitForm">
        <f:ajax execute="@form" event="click" render="tblObject"/>
    </h:commandButton>

当我点击按钮时,出现以下错误:

    java.lang.IllegalStateException error: Parameters processing failed.

该动作不是触发器,但如果我删除标签,一切正常,只是非 ajax。

这是后端代码:

    @Named
@RequestScoped
@Model
public class ProjectController implements Serializable {

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

@Inject private EntityManager em;
@Inject private Logger log;
//@Inject private FacesContext facesContext;
@Inject private Event<Project> projectEventSrc;

private String projectId;

@Produces
@Named
private Project project;

private Query query;

private List<Project> projectList;
private List<ProjectDTO> projectDtoList;



public ProjectController() {
    // Default constructor.
}

@PostConstruct
public void postInit(){
    // Init project
    project = new Project();

    // Get project list.
    query = em.createQuery("select project from Project project");
    projectList = query.getResultList();
    projectDtoList = new ArrayList<ProjectDTO>();

    for(Project project : projectList){
        ProjectDTO projectDTO = new ProjectDTO();
        projectDTO.setProjectId(project.getProjectId());
        projectDTO.setProjectName(project.getProjectName());
        projectDTO.setProjectStatus(23.4d);
        // Add to list.
        projectDtoList.add(projectDTO);
    }

}

public void loadProject(){
    // Load project here based on project id.
    if(projectId == null){
        // Do nothing.
        return;
    }

    // Load from DB.
    project = em.find(Project.class, projectId);
}

/**
 * Create new project.
 * @throws Exception
 */
public void create() throws Exception{
    log.info("Creating: " + project.getProjectName());
    project.setProjectId(UUID.randomUUID().toString());
    em.persist(project);
    //facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Registered!", "Registration successful"));
    projectEventSrc.fire(project);

    // Reinit.
    project = new Project();
}

public void setProjectId(String projectId) {
    this.projectId = projectId;
}

public String getProjectId(){
    return this.projectId;
}


public List<Project> getProjectList() {
    return projectList;
}

public void setProjectList(List<Project> projectList) {
    this.projectList = projectList;
}

public List<ProjectDTO> getProjectDtoList() {
    return projectDtoList;
}

public void setProjectDtoList(List<ProjectDTO> projectDtoList) {
    this.projectDtoList = projectDtoList;
}

}

有人知道吗?

4

3 回答 3

1

这是 JBoss AS 7.1.1 中的一个错误,仅在使用 IE 浏览器时才会出现。另见问题AS7-5143

到目前为止,唯一的解决方案似乎是降级到 JBoss AS 7.1.0。

于 2012-11-25T14:39:23.867 回答
0

我遇到了同样的问题,作为一种解决方法,如果您愿意包含第 3 方库,您可以改用 PrimeFaces commandButton。它默认使用 ajax,这似乎有效

于 2013-03-21T11:24:29.923 回答
0

就我而言,出现问题是因为我的一个自定义组件在没有属性“名称”的情况下被渲染。在我将属性包含在编码方法中后,问题就消失了。老板。7.1.1/jsf 2.1.10/Eclipse 朱诺

于 2013-04-09T14:23:04.747 回答