問題を調査しようとしましたが、解決策がまったく見つかりませんでした。ページネーションでprimefacesデータテーブルを使用しています。Ed Burns が彼のブログで提案したように、viewexpiredexception エラーの例外ハンドラーを書きましたが、ajax 送信 (データテーブル ページ ナビゲーションなど) と組み合わせて使用すると、vee でのページ リダイレクトは処理されません。私はBalusCが提案した解決策をJSFステータスバー/接続ステータス情報で使用しましたが、chromeはjsf.ajax.* javascript名前空間がないと言っています。このページは tomcat 7.0.22 で実行され、起動時にエラー/警告は発生せず、バックエンドは spring と mybatis に基づいています。ここにweb.xmlがあります
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Discontinui</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<session-config>
<session-timeout>2</session-timeout>
</session-config>
</web-app>
ここにfaces-config.xmlがあります
<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_2_0.xsd"
version="2.0">
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<factory>
<exception-handler-factory>it.dipvvf.vi.app.common.ViewExpiredExceptionExceptionHandlerFactory</exception-handler-factory>
</factory>
</faces-config>
これが index.xhtml ページです。
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Prova</title>
<script type="text/javascript">
var statusUpdate = function statusUpdate(data) {
var statusArea = document.getElementById("statusArea");
var text = statusArea.value;
text = text + "Name: "+data.source.id;
if (data.type === "event") {
text = text +" Event: "+data.name+"\n";
} else { // otherwise, it's an error
text = text + " Error: "+data.name+"\n";
}
statusArea.value = text;
};
// Setup the statusUpdate function to hear all events on the page
alert("0");
jsf.ajax.addOnEvent(statusUpdate);
alert("1");
jsf.ajax.addOnError(statusUpdate);
alert("2");
</script>
</h:head>
<h:body>
<h:form>
Selezionare il tipo di accesso:<br />
<p:selectOneMenu id="somAccessMode" value="#{accessMode.mode}">
<f:selectItem itemValue="#{accessMode.ufficioPersonale}"
itemLabel="Ufficio Personale" />
<f:selectItem itemValue="#{accessMode.capoTurno}"
itemLabel="Capo Turno" />
</p:selectOneMenu>
<br />
<p:commandButton id="bEnter" value="Entra"
action="#{accessMode.onEntraClick}" update="growl" />
<br />
<p:dataTable var="nominativo" value="#{accessMode.elencoNominativi}" paginator="true" rows="1"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15">
<p:column>
<f:facet name="header">
Cognome
</f:facet>
<h:outputText value="#{nominativo.cognome}" />
</p:column>
<p:column>
<f:facet name="header">
Nome
</f:facet>
<h:outputText value="#{nominativo.nome}" />
</p:column>
<p:column>
<f:facet name="header">
Data Iscrizione
</f:facet>
<h:outputText value="#{nominativo.iscrizione}">
<f:convertDateTime pattern="dd-MM-yyyy" />
</h:outputText>
</p:column>
</p:dataTable>
<hr />
<br />
<!-- <p:messages showDetail="true" autoUpdate="true"/> -->
<p:growl id="growl" showDetail="true" sticky="true" />
<h3>Status:</h3>
<textarea id="statusArea" cols="40" rows="10" readonly="readonly" />
</h:form>
</h:body>
</html>
テスト用に必要以上のものを入れました。アラート ("1") と "2" は表示されず、jsf.ajax.add... はブラウザーでエラーを発生させます。クロムでページを見て生成すると、mojarra パッケージにバンドルされた jsf.js が含まれていることがわかりません。欠陥はどこにありますか?
誰にでも感謝し、長々とすみません!