JSF rendering

Asked

Viewed 663 times

1

How do I render the components of Richfaces.

I have a combobox and when I click on an item I want it to render my form according to my item.

Examples please.

  • 2

    Hello Johnatan, welcome to Stack Overflow. So that we can assist you please complete your question with more details. A concrete and self-contained example with snipets of code relevant to view and of Managed Beans involved is welcome. The way you asked your question (which is not really a question, it is a request for examples) the context has become very broad and it is very difficult to elaborate an objective answer.

  • Also put what you have tried to do, your difficulties and the results obtained so far.

1 answer

3

To update the screen partially, that is, only a chunk of it, after an action via Ajax you can use the attribute update if you have a button. See Richfaces documentation on this.

Example:

<a4j:commandButton value="update" reRender="infoBlock"/>
...
<h:panelGrid id="infoBlock">
    ...
</h:panelGrid>

In case you want to perform an update after selecting a combo item, this is possible through the tag <a4j:ajax>. See a official example:

<h:form>
    <h:selectOneMenu value="#{selectsBean.currentType}" valueChangeListener="#{selectsBean.valueChanged}">
        <f:selectItems value="#{selectsBean.firstList}" />
        <a4j:ajax event="valueChange" render="second" execute="@this" />
    </h:selectOneMenu>
    <a4j:outputPanel id="second" layout="block">
        <h:selectOneMenu value="#{selectsBean.currentType}" rendered="#{not empty selectsBean.currentType}">
            <f:selectItems value="#{selectsBean.secondList}" />
        </h:selectOneMenu>
    </a4j:outputPanel>
</h:form>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.