File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Regd : Implementation of jscookMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Regd : Implementation of jscookMenu" Watch "Regd : Implementation of jscookMenu" New topic
Author

Regd : Implementation of jscookMenu

Dipeeka Suryawanshi
Greenhorn

Joined: Jul 20, 2012
Posts: 6
Hi All,

I am using <t:jscookMenu/> for implementing Menu. Using JSF1.2 & Eclipse indigo with Apache tomcat7.0 apps server.

when i am clicking on menu it gives me viewExpired Exception.

my Code is like :

jsCookMenu.jsp :

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page session="false" contentType="text/html; charset=ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>jSCookMenu Implementor</title>
</head>
<body>
<f:view>
<h:form id="MenuForm">
<t:jscookMenu layout="hbr" theme="ThemeOffice">
<t:navigationMenuItem itemLabel="File">
<t:navigationMenuItem action="new-file" itemLabel="New"/>
<t:navigationMenuItem action="open-file" itemLabel="Open"/>
<!-- <t:navigationMenuItem action="#{menuBB.navItems }" itemLabel="Close" />-->
<t:navigationMenuItem action="Close" icon="images/arrow-ff.gif" itemLabel="Close"></t:navigationMenuItem>
<t:navigationMenuItems value="#{menuBB.navItems}"></t:navigationMenuItems>
</t:navigationMenuItem>

<t:navigationMenuItem itemLabel="Edit">
....
</t:navigationMenuItem>
</t:jscookMenu>
</h:form>
</f:view>
</body>
</html>

DynamicMenuTest.java :

package com.aliasBean.example.domain;

import org.apache.myfaces.custom.navmenu.NavigationMenuItem;

public class DynamicMenuTest {

private NavigationMenuItem[] navItems;

public DynamicMenuTest() {

// children for item 2
NavigationMenuItem[] subItems = new NavigationMenuItem[2];
subItems[0] = new NavigationMenuItem("Subitem 2_1 Label","action2_1", "iconUrl", false);
subItems[1] = new NavigationMenuItem("Subitem 2_2 Label","action2_2", "iconUrl", false);

// item 2
NavigationMenuItem itemWithChildren = new NavigationMenuItem("Item 2 Label", "action2", "iconUrl", false);
itemWithChildren.setNavigationMenuItems(subItems);

// root items
navItems = new NavigationMenuItem[3];
navItems[0] = new NavigationMenuItem("Item 1 Label","action1", "iconUrl", false);

navItems[1] = itemWithChildren;
navItems[2] = new NavigationMenuItem("Item 3 Label","action3", "iconUrl", false);

System.out.println("navItem -->"+navItems[2]);
}

public NavigationMenuItem[] getNavItems() {
return navItems;
}

public void setNavItems(NavigationMenuItem[] navItems) {
this.navItems = navItems;
}


public String close()
{
System.exit(0);

return "exit";
}
}

faces-config.xml :

<managed-bean>
<managed-bean-name>menuBB</managed-bean-name>
<managed-bean-class>com.aliasBean.example.domain.DynamicMenuTest</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>

</managed-bean>

<navigation-rule>
<from-view-id>/jsCookMenu.jsp</from-view-id>
<navigation-case>
<from-outcome>exit</from-outcome>
<to-view-id>/jsCookMenu.jsp</to-view-id>
</navigation-case>
</navigation-rule>

web.xml :

<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/sessionExpired.jsf</location>
</error-page>

<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/sessionExpired.jsf</location>
</error-page>

<error-page>
<error-code>404</error-code>
<location>/sessionExpired.jsf</location>
</error-page>

<error-page>
<error-code>500</error-code>
<location>/sessionExpired.jsf</location>
</error-page>

In web.xml file i have already defined that ViewExpired Exception.
Still when i am clicking on Menu to perform some action it gives " javax.faces.application.ViewExpiredException ".

Please provide me the solution ,why i am facing this exception.
 
jQuery in Action, 2nd edition
 
subject: Regd : Implementation of jscookMenu