Это моя первая попытка использования JSCookMenu и его домашней страницы (http://jscook.yuanheng.org/JSCookMenu/) не работает более недели, поэтому простите, если там появится ответ на мой вопрос.
У меня есть простое веб-приложение, урезанное для того, чтобы протестировать перенаправление действий JSCookMenu на новую страницу JSF.
У меня есть страница администратора с JSCookMenu (теги Apache MyFaces Tomahawk) с 2 пунктами меню «Дом безAL 'и' Home With AL '. Я ожидаю, что когда я нажму на эти пункты меню, я перейду на "домашнюю" страницу, которая пока просто покажет сообщение "Hello World". Однако такой навигации не происходит.Мы будем очень благодарны за толчок в правильном направлении: -)
Вот моя конфигурация лица, моя страница администратора (которая использует страницу макета), моя домашняя страница, мой web.xml (с сопоставленным фильтром) иописание того, что происходит, когда я нажимаю на пункт меню.
Face-config.xml:
<!-- Copyright 2004-2006 Sun Microsystems, Inc. All rights reserved.
SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. -->
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
<!-- from project setup -->
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<navigation-rule>
<navigation-case>
<from-outcome>go_home</from-outcome>
<to-view-id>/home.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
layout.xhtml:
<!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:m="http://code.google.com/p/gmaps4jsf/">
<head>
<title>
<ui:insert name="title">Beach Water Quality</ui:insert>
</title>
<!-- JSCook Menu -->
<script language="JavaScript" src="jscookmenu/JSCookMenu.js" type="text/javascript" />
<script language="JavaScript" src="jscookmenu/ThemeOffice/theme.js" />
<link rel="stylesheet" href="jscookmenu/ThemeOffice/theme.css" type="text/css" />
<script language="JavaScript" src="jscookmenu/ThemeMiniBlack/theme.js" />
<link rel="stylesheet" href="jscookmenu/ThemeMiniBlack/theme.css" type="text/css" />
<script language="JavaScript" src="jscookmenu/ThemeIE/theme.js" />
<link rel="stylesheet" href="jscookmenu/ThemeIE/theme.css" type="text/css" />
<script language="JavaScript" src="jscookmenu/ThemePanel/theme.js" />
<link rel="stylesheet" href="jscookmenu/ThemePanel/theme.css" type="text/css" />
<script language="JavaScript" src="jscookmenu/ThemeGray/theme.js" />
<link rel="stylesheet" href="jscookmenu/ThemeGray/theme.css" type="text/css" />
<script language="JavaScript" src="jscookmenu/ThemeOffice2003/theme.js" />
<link rel="stylesheet" href="jscookmenu/ThemeOffice2003/theme.css" type="text/css" />
</head>
<body onLoad="#{onload}">
<h:panelGrid id="container_div" forceId="true" >
<ui:insert name="header">
<ui:include src="header.xhtml"/>
</ui:insert>
<ui:insert name="content">
<!-- include default content in here -->
</ui:insert>
<ui:insert name="footer">
<ui:include src="footer.xhtml"/>
</ui:insert>
</h:panelGrid>
</body>
</html>
admin.jsp:
<jsp:forward page="admin.jsf"/>
admin.xhtml:
<!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"
xmlns:m="http://code.google.com/p/gmaps4jsf/"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:t="http://myfaces.apache.org/tomahawk" >
<ui:composition template="/WEB-INF/layout/layout.xhtml">
<ui:define name="content">
<f:view contentType="text/html">
<h:form id="form" >
<t:jscookMenu layout="vbr" theme="ThemeIE">
<t:navigationMenuItem itemLabel="Home" itemValue="go_home" action="go_home"/>
</t:jscookMenu>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</html>
home.jsp:
<jsp:forward page="/home.jsf"/>
home.xhtml:
<!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"
xmlns:m="http://code.google.com/p/gmaps4jsf/"
xmlns:c="http://java.sun.com/jstl/core" >
<ui:composition template="/WEB-INF/layout/layout.xhtml">
<ui:define name="content">
<f:view contentType="text/html">
<h:form id="form" >
<h:outputText value="Hello World"/>
</h:form>
</f:view>
</ui:define>
</ui:composition>
</html>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<description>Beachwater web.xml</description>
<!-- Use Documents Saved as *.xhtml -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- Special Debug Output for Development -->
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<!-- Optional JSF-RI Parameters to Help Debug -->
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<!-- This is for File Upload -->
<filter>
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
<param-name>uploadMaxFileSize</param-name>
<param-value>20m</param-value>
</init-param>
<init-param>
<description>
Set the threshold size - files below this limit are stored
in memory, files above this limit are stored on disk.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
<init-param>
<description>
Set the path where the intermediary files will be stored.
</description>
<param-name>uploadRepositoryPath</param-name>
<param-value>/temp</param-value>
</init-param>
</filter>
<!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
</web-app>
У меня есть томагавк12-1.1.9.jar в моем classpath (также пробовал tomahawk-1.1.9.jar), который я скачал с http://myfaces.apache.org/tomahawk/download.html.
У меня есть папка jscookmenu в корне моего веб-приложения, содержащаяпапка для каждой темы (каждая с theme.css и theme.js), effect.js и JSCookMenu.js из jscookmenu-2.0.4.zip, которые я скачал с http://sourceforge.net/projects/jscook/files/. Последний выпуск был 2009-05-25.
Веб-приложение развернуто на Sun GlassFish Enterprise Server v2.1 на локальном хосте.
Я перехожу к http://localhost:8080/beachwater/admin.jsp и нажимаю на пункт меню Главное.
Откроется новое окно с адресной строкой, "http://localhost:8080/beachwater/form_j_id7_menu:A%5Dgo_home" и содержимым," Страница ошибки Glassfish, HTTP-статус 404: Запрошенный ресурс () недоступен. "
На сервер ничего не записывается.log
Окно открывается функцией cmItemMouseUp в JSCookMenu.js.У меня неправильная версия JavaScript?Любые идеи, почему фильтр не вызывает действие, указанное в face-config?