Board index JavaServer Faces General JQuery library is needed?

JQuery library is needed?

Components, Ajax Framework, Utilities and More.

Post 08 Apr 2013, 22:27

Posts: 6
In my web project I have installed the PrimeFaces library. I'm not sure, but I want to know if it is necessary to also reference the libraries in the project jquery and jquery-ui. If these two do not include them in my project, the menuButton not work. Despite this, if included, the menuButton works in Firefox and Safari, but not in Internet Explorer 8. Am I doing something wrong?

Thanks.

Post 08 Apr 2013, 22:29

Posts: 15070
Location: Cybertron

No, you just need to make sure you have h:head component in your page.
PrimeFaces Lead

Post 08 Apr 2013, 22:34

Posts: 6
optimus.prime wrote:
No, you just need to make sure you have h:head component in your page.



This code is not working. Missing some additional configuration?

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui">
   
   <h:head>
   </h:head>
   
   <h:body>   

   <h:form id="frmHome">

      <p:menuButton value="Navigate">
         <p:menuitem value="Iniciar Sesion" url="#" />
         <p:menuitem value="Cargar mi CV" url="#" />
      </p:menuButton>

   </h:form>

   </h:body> 

</html>   

Post 08 Apr 2013, 23:51

Posts: 15070
Location: Cybertron

Looks fine except you don't have a doctype.

Do you get any JS errors? What is the html output?
PrimeFaces Lead

Post 11 Apr 2013, 18:34

Posts: 6
optimus.prime wrote:
Looks fine except you don't have a doctype.

Do you get any JS errors? What is the html output?



This is the html code.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <link type="text/css" rel="stylesheet"
      href="/PrimeFaces/javax.faces.resource/theme.css.jsf?ln=primefaces-aristo" />
   <link type="text/css" rel="stylesheet"
      href="/PrimeFaces/javax.faces.resource/primefaces.css.jsf?ln=primefaces" />
   <script type="text/javascript"
      src="/PrimeFaces/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces">
   </script>
   <script type="text/javascript"
      src="/PrimeFaces/javax.faces.resource/jquery/jquery-plugins.js.jsf?ln=primefaces">
   </script>
   <script type="text/javascript"
      src="/PrimeFaces/javax.faces.resource/primefaces.js.jsf?ln=primefaces">
   </script>
</head>

<body>
   <form id="frmHome" name="frmHome" method="post"
      action="/PrimeFaces/paginas/home/home.jsf;
      jsessionid=CAA627DF0F1BC7661D9A1C5DEE67FCAA"
      enctype="application/x-www-form-urlencoded">
      <input type="hidden" name="frmHome" value="frmHome" />
      <span id="frmHome:j_idt4" class="ui-menubutton">
         <button id="frmHome:j_idt4_button" name="frmHome:j_idt4_button"
            type="button"
            class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left">
            <span class="ui-button-icon-left ui-icon ui-c ui-icon-triangle-1-s"></span>
            <span class="ui-button-text ui-c">Navigate</span>
         </button>
            <div id="frmHome:j_idt4_menu"
               class="ui-menu ui-menu-dynamic ui-widget ui-widget-content
                     ui-corner-all ui-helper-clearfix ui-shadow"
               role="menu">
            <ul class="ui-menu-list ui-helper-reset">
               <li class="ui-menuitem ui-widget ui-corner-all"
                  role="menuitem">
               <a id="frmHome:j_idt5"
                  class="ui-menuitem-link ui-corner-all" href="#">
               <span class="ui-menuitem-text">Iniciar Sesion</span>
               </a>
               </li>
               <li class="ui-menuitem ui-widget ui-corner-all"
                  role="menuitem">
               <a id="frmHome:j_idt6" class="ui-menuitem-link ui-corner-all" href="#">
                  <span class="ui-menuitem-text">Cargar mi CV</span>
               </a>
               </li>
            </ul>
            </div>
               </span>
                  <script id="frmHome:j_idt4_s" type="text/javascript">
                     $(function(){PrimeFaces.cw('MenuButton','widget_frmHome_j_idt4',{id:'frmHome:j_idt4'});});
                  </script>
                  <input type="hidden" name="javax.faces.ViewState"
                     id="javax.faces.ViewState"
                     value="6862480019439865476:-6817880496576995768" autocomplete="off" />
      </form></body> 
</html>


No error JS.

Thanks.

Post 30 Apr 2013, 09:04

Posts: 4
PrimeFaces 3.5 | GlassFish 3.1.2.2 | JSF 2.1
NetBeans 7.2.1 | JDK 1.6 | Java EE 6 | Apache Derby 10.8.1.2
Windows Vista, Firefox 20

Post 30 Apr 2013, 09:35
andyba User avatar
Expert Member

Posts: 2208
Location: Steinfeld, near Bremen/Osnabrück, DE

jab66 wrote:
optimus.prime wrote:
Looks fine except you don't have a doctype.

Do you get any JS errors? What is the html output?



This is the html code.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <link type="text/css" rel="stylesheet"
      href="/PrimeFaces/javax.faces.resource/theme.css.jsf?ln=primefaces-aristo" />
   <link type="text/css" rel="stylesheet"
      href="/PrimeFaces/javax.faces.resource/primefaces.css.jsf?ln=primefaces" />
   <script type="text/javascript"
      src="/PrimeFaces/javax.faces.resource/jquery/jquery.js.jsf?ln=primefaces">
   </script>
   <script type="text/javascript"
      src="/PrimeFaces/javax.faces.resource/jquery/jquery-plugins.js.jsf?ln=primefaces">
   </script>
   <script type="text/javascript"
      src="/PrimeFaces/javax.faces.resource/primefaces.js.jsf?ln=primefaces">
   </script>
</head>

<body>
   <form id="frmHome" name="frmHome" method="post"
      action="/PrimeFaces/paginas/home/home.jsf;
      jsessionid=CAA627DF0F1BC7661D9A1C5DEE67FCAA"
      enctype="application/x-www-form-urlencoded">
      <input type="hidden" name="frmHome" value="frmHome" />
      <span id="frmHome:j_idt4" class="ui-menubutton">
         <button id="frmHome:j_idt4_button" name="frmHome:j_idt4_button"
            type="button"
            class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left">
            <span class="ui-button-icon-left ui-icon ui-c ui-icon-triangle-1-s"></span>
            <span class="ui-button-text ui-c">Navigate</span>
         </button>
            <div id="frmHome:j_idt4_menu"
               class="ui-menu ui-menu-dynamic ui-widget ui-widget-content
                     ui-corner-all ui-helper-clearfix ui-shadow"
               role="menu">
            <ul class="ui-menu-list ui-helper-reset">
               <li class="ui-menuitem ui-widget ui-corner-all"
                  role="menuitem">
               <a id="frmHome:j_idt5"
                  class="ui-menuitem-link ui-corner-all" href="#">
               <span class="ui-menuitem-text">Iniciar Sesion</span>
               </a>
               </li>
               <li class="ui-menuitem ui-widget ui-corner-all"
                  role="menuitem">
               <a id="frmHome:j_idt6" class="ui-menuitem-link ui-corner-all" href="#">
                  <span class="ui-menuitem-text">Cargar mi CV</span>
               </a>
               </li>
            </ul>
            </div>
               </span>
                  <script id="frmHome:j_idt4_s" type="text/javascript">
                     $(function(){PrimeFaces.cw('MenuButton','widget_frmHome_j_idt4',{id:'frmHome:j_idt4'});});
                  </script>
                  <input type="hidden" name="javax.faces.ViewState"
                     id="javax.faces.ViewState"
                     value="6862480019439865476:-6817880496576995768" autocomplete="off" />
      </form></body> 
</html>


No error JS.

Thanks.

That is the output source code, we need the XHTML file (the real source code).
PF 3.4.2, PF 3.5.10, PF 4.x (Elite versions)
Glassfish 3.1.2.2, Mojarra 2.x, under both Java 6 and Java 7.
If you haven't read the forum rules read them now
My blog: http://onthefaceofthings.blogspot.de/
PrimeFaces Project


Return to General