接缝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>

您的帮助非常感谢!

有帮助吗?

解决方案

事实证明,我缺少一些JSF依赖性: jsf-api.jarjsf-impl.jar. 。随后,它采用了我的容器(WebSphere)提供的错误版本,因此它不起作用。一旦应用了这些依赖性罐子和正确的版本,一切都很好!

其他提示

如果找不到JBOSS,也可能会丢弃此错误 seam.properties 在您的应用程序中 src/conf 目录。该文件可能是空的,但是需要在那里才能使范围处于活动状态。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top