Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.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
为什么ajax调用会触发对任何的求值,即使它位于渲染区域之外?_Ajax_Jsf_Jsf 2 - Fatal编程技术网

为什么ajax调用会触发对任何的求值,即使它位于渲染区域之外?

为什么ajax调用会触发对任何的求值,即使它位于渲染区域之外?,ajax,jsf,jsf-2,Ajax,Jsf,Jsf 2,坦率地说,我不明白为什么JSF需要在下面的示例中评估的值属性: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> <h:head/> <h

坦率地说,我不明白为什么JSF需要在下面的示例中评估的值属性:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
  <h:head/>
  <h:body>
    <h:form>
      <h:panelGroup id="date" layout="block">
        <h:outputText value="#{testBean.currentDate}"/>
      </h:panelGroup>

      <h:commandButton value="Ajax!">
        <f:ajax execute="@this" render="date"/>
      </h:commandButton>

      <!-- "value" attr gets evaluated per each ajax call -->
      <ui:repeat value="#{testBean.list1}" var="obj" >
        <h:outputText value="#{obj}"/>
      </ui:repeat>

      <!-- no evaluation happens here -->
      <h:dataTable value="#{testBean.list2}" var="obj">
        <h:column>
          <h:outputText value="#{obj}"/>
        </h:column>
      </h:dataTable>
    </h:form>
  </h:body>
</html>

很可能是莫哈拉的错误/疏忽。我正在联系一名开发人员,请继续关注…@BalusC,谢谢。这是Mojarra版本:Mojarra 2.2.0 20130502-2118,服务器-GF4
@Named
@SessionScoped
public class TestBean implements Serializable {

  private static final Logger LOG = Logger.getLogger(TestBean.class.getName());
  private static final List<String> list = Arrays.asList("1", "2", "3");

  public List<String> getList1() {
    LOG.info("Evaluated 1");
    return list;
  }

  public List<String> getList2() {
    LOG.info("Evaluated 2");
    return list;
  }

  public String getCurrentDate() {
    return (new Date()).toString();
  }
}