Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JSF页面-为什么还不需要验证流程属性?_Java_Jsf 2_Primefaces - Fatal编程技术网

Java JSF页面-为什么还不需要验证流程属性?

Java JSF页面-为什么还不需要验证流程属性?,java,jsf-2,primefaces,Java,Jsf 2,Primefaces,以下基于JSF的xhtml页面的命令按钮的actionListener事件不起作用。我在页面上没有任何验证。该事件仅在我将属性process=“@this”添加到按钮标记时有效。因为没有验证,所以我甚至没有得到任何验证错误。但通过process属性,我得到了java端处理程序方法返回的成功消息。因此,我被困在没有不需要的进程属性的地方 <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE html PUBLIC "-//W

以下基于JSF的xhtml页面的命令按钮的
actionListener
事件不起作用。我在页面上没有任何验证。该事件仅在我将属性
process=“@this”
添加到按钮标记时有效。因为没有验证,所以我甚至没有得到任何验证错误。但通过process属性,我得到了java端处理程序方法返回的成功消息。因此,我被困在没有不需要的进程属性的地方

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:c="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui">

<h:head>

</h:head>

<h:body style="margin:0 auto !important;width:80% !important;">
<h:form id="form1">
    <p:panel id="rootPanel"
        style="background-color:#E8E8E8 ;width=90%;padding:10px;margin:10px;border:2px solid black;">
        <p:panel id="logoHeaderPanel"
            style="background-color:#E8E8E8 ;width=70%;padding:30px;margin:30px;border:1px solid black;">
            <h:panelGrid columns="2">
                <h:graphicImage library="images" name="./headerImage.gif"  />
                <h:outputLabel style="font-size:2.1em;margin-left:30px"
                    value="Demo App" />
            </h:panelGrid>
        </p:panel>
          <p:messages id="messages" autoUpdate="true"/>
        <p:panel id="mainContentPanel"
            style="background-color:#E8E8E8 ;width=70%;padding:60px;margin:30px;border:1px solid black;">
            <h:panelGrid columns="4">
                <h:outputLabel for="a" value="State Search" style="margin:10px;" />
                <p:inputText id="a" value="" style="margin:10px;" />
                <h:outputLabel for="b" value="Value" style="margin:10px;" />
                <p:inputText id="b" value="" style="margin:10px;" />

                <h:outputLabel for="c" value="City Search" style="margin:10px;" />
                <p:inputText id="c" value="" style="margin:10px;" />
                <h:outputLabel for="d" value="Value" style="margin:10px;" />
                <p:inputText id="d" value="" style="margin:10px;" />
            </h:panelGrid>
            <h:panelGrid columns="2" style="float:right;">
                <p:commandButton style="height:80px;" value="Generate Report"
                            id="reporting" actionListener="#{sampleBean.handlerMethod}" update="a"/>
            </h:panelGrid>
        </p:panel>
    </p:panel>
    </h:form>
</h:body>
</html>

您不能在
p:inputText
中使用
value=“
。如果不想指定值,则应删除属性
value=”“


public void handlerMethod(ActionEvent actionEvent) {
        System.out.println("Inside Listener");
        FacesContext.getCurrentInstance().addMessage(
                null,
                new FacesMessage("Success! Action called."));
}
<p:inputText id="a" style="margin:10px;" />