I have a problem with my JSF page which uses PrimeFaces components. As it may get long and boring quickly, I try to be as brief as possible. Consider this managed bean:
@Named(value = "testBean") @RequestScoped public class TestBean implements Serializable { private String test; public String update() { test = "Updated."; return "test"; } // Getters and Setters... } Here's the body of test.xhtml, with irrelevant content and styles removed:
<h:body> <p:layout id="layout" fullPage="true"> <p:layoutUnit position="north"> <!-- Does not matter --> </p:layoutUnit> <p:layoutUnit id="input" position="west"> <p:panel header=""> <p:tabView> <p:tab title=""> <!-- INPUTS and SUBMIT BUTTON --> </p:tab> </p:tabView> </p:panel> </p:layoutUnit> <p:layoutUnit id="output" position="center"> <h:form> <p:panel id="display" header="Information"> <h:outputText value="#{testBean.test}" /> </p:panel> <p:separator /> <p:commandButton value="Update !" action="#{testBean.update()}" ajax="false" /> </h:form> </p:layoutUnit> <p:layoutUnit position="south"> <!-- Does not matter --> </p:layoutUnit> </p:layout> </h:body> And everything works fine. I've got two problems though:
I should move the
commandButtonto anotherlayoutUnit(input) and I can't place the<h:form>element in a reasonable position. I tried moving it beside<p:layout>so it encloses all layout units but it broke (the updated page no longer has the "Updated." string).I want to perform the update via ajax with the button on another layoutUnit. When I remove the
ajax="false"attribute from thecommandButtonand set an attribute ofprependId="false"for the global form element, the output text does not get updated.
Thanks in advance for your help