これは JSCookMenu を使用する初めての試みであり、そのホームページ ( http://jscook.yuanheng.org/JSCookMenu/ ) は 1 週間以上ダウンしているため、私の質問に対する回答がそこに表示される場合はご容赦ください。
新しいJSFページへのJSCookMenuのアクション転送をテストするために、単純なWebアプリケーションを削除しました。
「Home Without AL」と「Home With AL」という 2 つのメニュー項目を持つ JSCookMenu (Apache MyFaces Tomahawk タグ) を含む管理ページがあります。これらのメニュー項目をクリックすると、今のところ「Hello World」メッセージが表示される「ホーム」ページに移動することを期待しています。ただし、このナビゲーションは行われていません。正しい方向へのプッシュは大歓迎です:-)
これは、faces-config、管理ページ (レイアウト ページを使用)、ホームページ、web.xml (フィルターがマップされている)、およびメニュー項目をクリックしたときに何が起こるかの説明です。
顔-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>
レイアウト.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>
ホーム.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>
http://myfaces.apache.org/tomahawk/download.htmlからダウンロードしたクラスパスに tomahawk12-1.1.9.jar があります ( tomahawk-1.1.9.jar も試しました) 。
webapp のルートに jscookmenu フォルダーがあり、各テーマ (それぞれに theme.css と theme.js を含む)、effect.js、および jscookmenu-2.0.4.zip の JSCookMenu.js のフォルダーが含まれています。http://sourceforge.net/projects/jscook/files/からダウンロードしました。最新のリリースは 2009-05-25 でした。
Web アプリケーションは、localhost の 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: 要求されたリソース () は利用できません" が表示されます。
server.log には何も書き込まれません
ウィンドウは、JSCookMenu.js の cmItemMouseUp 関数によって開かれています。JavaScript のバージョンが間違っていますか? フィルターがfaces-configで指定されたアクションを呼び出さない理由はありますか?