无法创建Seam组件,PAGE范围不活动; selectBooleanCheckbox

时间:2013-11-08 08:22:03

标签: jsf seam jsf-1.2 seam2

Seam 2.2.2,JSF 1.2。听起来很简单:dataTable每个行都有一个复选框,我想在调用某个按钮时观察它。我有一个控制器:

@Name("MyController")
@Scope(ScopeType.PAGE)
public class MyController {
    private List<MyItem> myItems;

    public MyItem[] getItemsList(boolean excluded) {
            return myItems;
    }

我有MyItem类型:

public class MyItem {
    private boolean selected = false;

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        System.out.println("setting to " + selected);
        this.selected = selected;
    }

    ... other things ...
}

这是我的XHTML:

<a:form id="formExcludedList">
    <rich:dataTable id="excludeList"
        value="#{MyController.getItemsList(true)}" var="o">
        <rich:column>
            <h:selectBooleanCheckbox id="selectComponent"
                value="#{o.selected}" />
        </rich:column>

单击复选框MyItem.setSelected时未执行。我虽然得到了一些时髦的记录:(为了简洁而修饰)

DEBUG createHotDeployment - Using Java hot deploy
DEBUG beginRequest - >>> Begin JSF request for <my page>
DEBUG begin - beginning transaction prior to phase: RESTORE_VIEW(1)
DEBUG begin - beginning JTA transaction
WARN  getInstance - Cannot create Seam component, scope is not active: MyController(PAGE)
WARN  getInstance - Cannot create Seam component, scope is not active: MyController(PAGE)
WARN  getInstance - Cannot create Seam component, scope is not active: MyController(PAGE)
WARN  getInstance - Cannot create Seam component, scope is not active: MyController(PAGE)
DEBUG restoreAndLockConversation - No stored conversation
DEBUG commitOrRollback - committing transaction after phase: INVOKE_APPLICATION(5)
DEBUG commit - committing JTA transaction
DEBUG begin - beginning transaction prior to phase: RENDER_RESPONSE(6)
DEBUG begin - beginning JTA transaction
DEBUG commitOrRollback - committing transaction after phase: RENDER_RESPONSE(6)
DEBUG commit - committing JTA transaction
DEBUG endRequest - Discarding conversation state: 7
DEBUG endRequest - After render response, destroying contexts
DEBUG flushAndDestroyContexts - ... et cetera
DEBUG destroy - destroying: ...
DEBUG destroy - destroying: ... et cetera
DEBUG endRequest - <<< End JSF request for <my page>

非常感谢您的帮助!

2 个答案:

答案 0 :(得分:2)

原来我错过了一些JSF依赖项:jsf-api.jarjsf-impl.jar。随后它采用了我的容器(WebSphere)提供的版本,这些版本的版本错误,因此无法正常工作。一旦应用了这些依赖JAR和正确的版本,一切都很好!

答案 1 :(得分:0)

如果JBoss在您的应用程序的seam.properties目录中找不到src/conf,也可能会抛出此错误。该文件可能为空,但需要存在才能使作用域处于活动状态。