0

I'm trying to run a sample code on t:popup. I copied code is as below.

    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>t:popup example</title>
    <style type="text/css">
    <!--
       .popClass{
           background-color:#F1F1F1;
       }
    -->
    </style>
    </head>
    <body>
    <h:form>
      <t:popup styleClass="popClass"
               closePopupOnExitingElement="true"
               closePopupOnExitingPopup="true"
               displayAtDistanceX="0"
               displayAtDistanceY="0">
            <h:outputText value="JSF tutorials and examples." style="font-weight:bold;"/>
            <f:facet name="popup">
               <h:panelGrid columns="1" >
                 <h:commandLink value="http://roseindia.net/jsf" />
                 <h:commandLink value="http://myfaces.apache.org" /> 
               </h:panelGrid>
            </f:facet>
      </t:popup>
     </h:form>
    </body>
    </html>
    </f:view>

I'm using JSF 2.0 along with Tomahawk 1.1.13. Also I'm running the application on Apache tomcat 7. I dont know what the problem is but only the outputText is display and nothing happens when I do a mouseover on the text.

This is the first time I'm working with t:popup. If anyone faced a similar issue, please let me know how you resolved it.

Thanks, Jane

Jane
  • 127
  • 1
  • 9

1 Answers1

1

Since JSF 2.0, static resource handling has been improved. JS/CSS files where the components of the component libraries depend on are auto-included by new @ResourceDependency annotation. This requires a <h:head> component.

However, you're using JSP which is deprecated since JSF 2.0 and thus you won't be able to use all the new JSF 2.0 specific features/enhancements, including <h:head> tag.

If you replace the legacy JSP by its successor Facelets (XHTML), then you'll be able to use the <h:head> tag and finally the <t:popup> will be able to auto-include its JS/CSS files which are mandatory for the functioning and visual appearance.

See also:


Unrelated to the concrete problem, roseindia.net is one of the worst sites when it comes to Java EE related tutorials/resources. You also seem to be confusing/mixing up JSF 1.x and JSF 2.x targeted tutorials. When learning JSF 2.x, you should absolutely not look at JSF 1.x targeted resources as that would only confuse you because many things are done differently in JSF 2.x as compared to the old JSF 1.x.

See also:

Community
  • 1
  • 1
BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452