【问题标题】:jsf2 primefaces.js error $browser.msie is null or not an objectjsf2 primefaces.js 错误 $browser.msie 为空或不是对象
【发布时间】:2014-10-11 14:58:31
【问题描述】:

我有一个 primafaces selectOneMenu。当我单击呈现的菜单时,下拉列表没有出现,浏览器出现此错误。我正在使用 IE 8 和 primefaces 5。但是,当我更改为 h:selectOneMenu 时,下拉菜单可以正常工作。请帮忙,我卡住了。这是我的代码:

     <p:selectOneMenu id="app" value="#{refbean.selapp}" rendered="#{refbean.selItem =='SMS NOTIFICATION'}">
              <f:selectItem itemValue="Select" itemLabel="Select Application"></f:selectItem>
              <f:selectItems value="#{refbean.appList}"></f:selectItems>
              <f:ajax event="change"
                      execute="@this"
                      render="shownotif"
                      listener="#{refbean.setNotificationValues}">
               </f:ajax>
            </p:selectOneMenu>

I also tried using  <script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script> but the issue still remains.



I am not able to test the ajax call because the drop down menu is not populated at all in the first place. When I click on the drop down menu i see the javascript error in the browser : `$browser.msie is null or not an object.`  Here is my full code : 



 <p:panelGrid id="showOption">
         <p:row id="showsms" rendered="#{refbean.selItem =='SMS NOTIFICATION'}">
         <p:column>
        <p:outputLabel value="#{msg['createcr.app']}" rendered="#{refbean.selItem =='SMS NOTIFICATION'}" styleClass="LabelDescription"></p:outputLabel>
        </p:column>
        <p:column>
        <p:selectOneMenu id="app" value="#{refbean.selapp}" rendered="#{refbean.selItem =='SMS NOTIFICATION'}">
          <f:selectItem itemValue="Select" itemLabel="Select Application"></f:selectItem>
          <f:selectItems value="#{refbean.appList}"></f:selectItems>
          <f:ajax event="change"
                  execute="@this"
                  render="shownotif"
                  listener="#{refbean.setNotificationValues}">
           </f:ajax>
        </p:selectOneMenu>
        </p:column>
        </p:row>

        <p:row id="shownotif" rendered="#{refbean.selItem == 'SMS NOTIFICATION'}">
        <p:column>
          <p:outputLabel value="#{msg['createcr.notif']}" styleClass="LabelDescription"></p:outputLabel>
          </p:column>
          <p:column>
        <p:selectOneMenu id="notif" value="#{refbean.selnot}" rendered="#{refbean.selItem == 'SMS NOTIFICATION'}">
            <f:selectItem itemValue="Select" itemLabel="Select Notification List"></f:selectItem>
            <f:selectItems value="#{refbean.noList}"></f:selectItems>
            <f:ajax event="change"
                    execute="@this"
                    render="showtext"
                    listener="#{refbean.setSelNotification}"></f:ajax>
        </p:selectOneMenu>
      </p:column>
        </p:row>
</p:panelGrid>

【问题讨论】:

  • 尝试使用
  • 不要自己包含jquery,PF会做。其他 PF 组件是否有效?你有 h:head 吗?你有另一个表格里面的表格吗?我相信你应该在 PF 组件上使用 p:ajax 而不是 f:ajax
  • 下拉列表本身并没有出现在首位。浏览器抛出错误 $browser.msie is null or not an object。请帮忙,我坚持了两天。

标签: primefaces


【解决方案1】:

尝试使用 jquery-browser-plugin ,放置 jquery.browser.min.js 并将其包含在您的 web 应用中

一个用于浏览器检测的 jQuery 插件。 jQuery 在 1.9.1 上移除了对浏览器检测的支持,因此它被抽象为一个 jQuery 插件

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-01
    • 2013-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-27
    相关资源
    最近更新 更多