Note that with Myfaces 1.1.4 and higher, you're required to use h:form
tags around these components at all times.


On 8/31/06, Kumar, Abhilash (Gok) <[EMAIL PROTECTED]> wrote:
Hello :

  I have solved the problem. You have to add <h:form> tag around
<t:panelNavigation2> tag to make it work with facelets. Also, don't put
he form tag outside the div tags because then the style is not applied
correctly.

Thanks and regards,

-- Kannan

-----Original Message-----
From: Kumar, Abhilash (Gok)
Sent: Wednesday, August 30, 2006 9:55 PM
To: [email protected]
Subject: Tomahawk - panelNavigation2 with facelets

Hello:

   I am struggling to get the PanelNavigation with NavigationMenuItems
(Dynamic) example working with Facelets. The problem is that the
javascript function which will be called in the onclick of the div is
not generated in the page. This problem appear only when I use the
component with facelets. I have define the tomahawk.taglib.xml for
facelets which includes the navigationMenuItem and navigationMenuItems
tags.

I am using the following versions ;

tomahawk-1.1.3.jar
myfaces-impl-1.1.3.jar
myfaces-api-1.1.3.jar
jsf-facelets-1.1.11.jar

I have added the myfaces extensions filter in the web.xml also. I was
able to set up the file upload tomahawk component.
Below are my files.Can anyone pls tell what I have to do get this
working ?

Thanks and regards,

-- Kannan

1. template.xhtml - layout definition


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<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";>
<head>

    <title>Seam Generated Template</title>
    <link href="../stylesheet/theme.css" rel="stylesheet"
type="text/css" />
    <link rel="stylesheet" type="text/css"
href="../stylesheet/basic.css" />
</head>

<body>
        <div align="center">

        <ui:insert name="navigationBar"/>

   </div>
</body>
</html>


2. Navigation page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:s="http://jboss.com/products/seam/taglib";
      xmlns:ui="http://java.sun.com/jsf/facelets";
      xmlns:f="http://java.sun.com/jsf";
      xmlns:h="http://java.sun.com/jsf/html";
      xmlns:t="http://myfaces.apache.org/tomahawk";>


<ui:composition template="../layout/template.xhtml">
  <ui:define name="navigationBar">
       <t:div id="subnavigation_outer">
       <t:div id="subnavigation">
       <t:panelNavigation2 id="nav1" layout="list" itemClass="mypage"
activeItemClass="selected"
                            disabledStyle="color:red;padding: 2px 20px
2px 25px">
           <t:navigationMenuItems id="navitems"
value="#{navigationMenu.panelNavigationItems}" />
       </t:panelNavigation2>
       </t:div>
    </t:div>
</ui:define>
</ui:composition>
</html>


3. Backing Bean


import java.util.ArrayList;
import java.util.List;
import org.apache.myfaces.custom.navmenu.NavigationMenuItem;

public class Menu {

    public Menu(){ }


    public List getPanelNavigationItems() {


        List menu = new ArrayList();
        NavigationMenuItem products = new NavigationMenuItem("Products",
"#{navigationMenu.getAction}");

        menu.add(products);
        products.add(new NavigationMenuItem("P1",
"#{navigationMenu.getAction}"));
        products.add(new NavigationMenuItem("P3",
"#{navigationMenu.getAction}"));



        NavigationMenuItem corporateInfo = new
NavigationMenuItem("Info", "#{navigationMenu.getAction}");
        menu.add(corporateInfo);
        corporateInfo.add(new NavigationMenuItem("I1",
"#{navigationMenu.getAction}"));
        corporateInfo.add(new NavigationMenuItem("I2",
"#{navigationMenu.getAction}"));
        menu.add(new NavigationMenuItem("help",
"#{navigationMenu.getAction}"));
        return menu;
    }

    public String getAction()
    {
        return "go_panelnavigation_2";
    }
}












Reply via email to