0

I have a problem with f:ajax

When I click on a submit button, Ajax reload all the page, included preRenderView (my @PostConstruct method). Indeed, I've put System.out.print in my getters method, and they are called again after I click on a submit button.

I would like to only execute the form without reloading other components.

I've already tried with ui:repeat, I've got the same result.

JSF

<html 
xmlns="http://www.w3.org/1999/xhtml" 
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" >

<h:head>
</h:head>

<h:body>

    <f:metadata>
        <f:event listener="#{mainController.init()}" type="preRenderView" />
    </f:metadata>

    <h:panelGroup id="clients" >
        <c:forEach items="#{mainController.getClients()}" var="client" > 
            <h:panelGroup layout="block" id="#{client}" >
                #{client}
                <c:forEach items="#{mainController.getApplications(client)}" var="application" > 
                    <h:panelGroup layout="block" id="#{application}">
                        #{application}
                        <h:form id="form_#{application}" >
                            <h:commandButton value="Try" action="#{mainController.test()}" >
                                <f:ajax execute="@form" render="@none" /> 
                            </h:commandButton>
                        </h:form>
                    </h:panelGroup> 
                </c:forEach>
            </h:panelGroup>
        </c:forEach>
    </h:panelGroup>
</h:body>

Cœur
  • 37,241
  • 25
  • 195
  • 267

0 Answers0