求一个primefaces中p:commandButton组件无法以ajax方式调用bean的问题。
xhtml页面如下:<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">
<h:head>
<title>welcome!</title>
</h:head>
<h:body>
<f:view>
     <h:form prependId="false">
  <p:panel>
  <h:panelGrid>
       <h:outputText value="search by course name:" />
       <p:inputText value="#{paginateBean.cName}" />
       <p:commandButton value="Search" process="@form" update="ot" actionListener="#{paginateBean.searchCourse}" />
     </h:panelGrid>
     </p:panel>
    </h:form>
    <h:outputText id="ot" value="#{paginateBean.cName}" />
    </f:view>
</h:body>
</html>
bean中调用的方法:public String searchCourse(ActionEvent actionEvent){
System.out.println("do search course!" + "courseName:" + cName);
return null;
}
此处p:commandButton无法正常执行Ajax操作,不使用Ajax是可以的,我想知道这其中的原理。补充:
若去掉<h:head></h:head>,p:commandButton是可以执行Ajax操作了,但是primefaces的主题就没有了,button变成普通的button了。
或者改成<head></head>,也可以执行,但有错误信息:
一个或多个资源具有 'head' 的目标,但视图中却未定义 'head' 组件。 这又是啥情况?求高手指点一二。