小编Gei*_*chi的帖子

JSF更新复合组件

是否可以通过指定父组合ID来更新组合组件的子组件?例如,如果我有:

<composite:interface>
    <composite:attribute name="value" type="..." required="true"/>
</composite:interface>

<composite:implementation>
    <p:treeTable id="main-tree" ...>
        ...
    </p:treeTable>

</composite:implementation>
Run Code Online (Sandbox Code Playgroud)

并以某种方式使用它:

<my:comp id="composite-component" />

...

<p:ajax update="composite-component" />
Run Code Online (Sandbox Code Playgroud)

那可能吗?现在,我看到的唯一方法是明确指定子组件ID:

<p:ajax update="composite-component:main-tree" />
Run Code Online (Sandbox Code Playgroud)

java primefaces jsf-2

5
推荐指数
1
解决办法
6553
查看次数

为什么在任何其他托管bean之前创建JSF转换器?

JSF Converter似乎是在xhtml页面上的任何其他托管bean之前调用的.它甚至可以rendered=falseh:selectOneMenu组件上创建.

我已经创建了3个托管bean来测试初始化​​序列,并且托管bean按顺序初始化它们出现在xhtml中,但在它们之前,尽管是最后一个创建了JSF转换器.

形成

<h:form>
    <h:inputText value="#{creationTime1.string1}"/>
    <h:inputText value="#{creationTime3.string3}"/>
    <h:inputText value="#{creationTime2.string2}"/>
    <h:selectOneMenu value="#{creationTime1.competitor}" rendered="false" converter="#{testConverter}" >
        <f:selectItem itemValue="#{null}" itemLabel="#{msg.none}" />
        <f:selectItems value="#{creationTime1.competitorList}" var="competitor" itemValue="#{competitor}"
                       itemLabel="#{competitor.idCompetitor}"/>
    </h:selectOneMenu>
    <h:commandButton value="GO" action="#{creationTime1.submit}"/>
</h:form>
Run Code Online (Sandbox Code Playgroud)

变流器

@Named(value = "testConverter")
@ViewScoped
public class TestConverter implements Converter, Serializable {

    @PostConstruct
    private void init() {
        System.out.println(System.currentTimeMillis() +  " || TestConverter init");
    }

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        ...
    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) { …
Run Code Online (Sandbox Code Playgroud)

jsf converter cdi

1
推荐指数
1
解决办法
304
查看次数

标签 统计

cdi ×1

converter ×1

java ×1

jsf ×1

jsf-2 ×1

primefaces ×1