I want to process a form but I want that the event was fired from other form throught a p:commandButton. I put here some code to better explain myself .
This is the facelets page:
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:sd="http://java.sun.com/jsf/composite/customTag">
<h:head>
<title>The example</title>
</h:head>
<h:body>
<h:form id="form1">
<p:commandButton value="Test" id="buttonSave" ajax="true" actionListener="#{ejemplo.bTest}" update=":form3" process="@this :form2"/>
</h:form>
<h:form id="form2">
<p:inputText id="id_field" value="#{ejemplo.texto}" />
</h:form>
<h:form id="form3">
<h:outputText id="id_f1" value="#{ejemplo.texto}" />
</h:form>
</h:body>
</html>
I want to process the inputText that is in the form2, but the button is in the form1, but the value in the inputText from form2 isn't sent in the request.
Then I want to update the value in the outputText of the form3, this works properly with the configuration in the example, and I suppose that configuring the same way the process attribute it will work but it doesn't.
This is the backing Bean:
Code: Select all
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name = "ejemplo")
@SessionScoped
public class Ejemplo {
String texto;
public void bTest() {
System.out.println("Ejemplo: " + texto);
}
public String getTexto() {
return texto;
}
public void setTexto(String texto) {
this.texto = texto;
}
}
I want to know if there is a way to do that I explain before, process a form from another form.