2011-11-11 35 views
2

を返す終わると我々はPrimefaces 3M4を使用していて、私達のページの一つは、APがあります。ページアウトセッション時間がリダイレクトされる場合はリダイレクトAjaxリクエストへの応答が空

<p:ajax event="rowSelect" update=":newsForm:newsDlg" oncomplete="newsDlg.show();"/> 

:dataTableのイベントのためのAjaxの呼び出しを使用しています/ ajax以外のアクション(メニュー項目など)でうまく動作する/login.xhtmlに書き換えられますが、セッションの期限が切れた後にデータテーブル内の行を選択すると、ページはログインページとFirebugに変わりません:

ダッシュボードxhtmlの下でFirebugのヘッダーセクション

login.xhtmlのヘッダ

Response Headers 
Server Apache-Coyote/1.1 
X-Powered-By JSF/2.0 
Cache-Control no-cache 
Set-Cookie JSESSIONID=MdhyizD+8IkuFvLZD+6jWlUz; Path=/RetailerPortal 
Content-Type text/xml;charset=UTF-8 
Content-Length 196 
Date Fri, 11 Nov 2011 18:32:42 GMT 
Request Headers 
Host localhost:8080 
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0 
Accept application/xml, text/xml, */*; q=0.01 
Accept-Language en-us,en;q=0.5 
Accept-Encoding gzip, deflate 
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 
Connection keep-alive 
Referer http://localhost:8080/RetailerPortal/faces/dashboard.xhtml 
X-Requested-With XMLHttpRequest 
Faces-Request partial/ajax 
Content-Type application/x-www-form-urlencoded 
Cookie csfcfc=_30Xsr; JSESSIONID=fg1bV1sZkzKIgNtkH0bz0N0f; JSESSIONID=C65BF4EED70299ABFE4B73614118295E 
01アンダー
Response Headers 
Server Apache-Coyote/1.1 
X-Powered-By JSF/2.0 
Location http://localhost:8080/RetailerPortal/faces/login.xhtml 
Content-Length 0 
Date Fri, 11 Nov 2011 18:32:42 GMT 

Request Headers 
Host localhost:8080 
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0 
Accept application/xml, text/xml, */*; q=0.01 
Accept-Language en-us,en;q=0.5 
Accept-Encoding gzip, deflate 
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 
Connection keep-alive 
Content-Type application/x-www-form-urlencoded; charset=UTF-8 
Faces-Request partial/ajax 
X-Requested-With XMLHttpRequest 
Referer http://localhost:8080/RetailerPortal/faces/dashboard.xhtml 
Content-Length 389 
Cookie csfcfc=_30Xsr; JSESSIONID=fg1bV1sZkzKIgNtkH0bz0N0f; JSESSIONID=C65BF4EED70299ABFE4B73614118295E 

dashboard.xhtml応答の下で

<?xml version='1.0' encoding='ISO-8859-1'?> 
<partial-response><changes><update id="javax.faces.ViewState"><![CDATA[-3728406524126180805:2441995557020829808]]></update></changes></partial-response> 

dashbaoard.xhtmlポストの下で

Parametersapplication/x-www-form-urlencoded 
javax.faces.ViewState 7521050094575005695:7928145831130537413 
javax.faces.behavior.even... rowSelect 
javax.faces.partial.ajax true 
javax.faces.partial.event rowSelect 
javax.faces.partial.execu... newsForm:newsTable 
javax.faces.partial.rende... newsForm:newsDlg 
javax.faces.source newsForm:newsTable 
newsForm newsForm 
newsForm:newsTable_instan... 3 
newsForm:newsTable_select... 3 
Source 
newsForm=newsForm&newsForm%3AnewsTable_selection=3&javax.faces.ViewState=7521050094575005695%3A7928145831130537413&javax.faces.partial.ajax=true&javax.faces.source=newsForm:newsTable&javax.faces.partial.execute=newsForm:newsTable&javax.faces.partial.render=newsForm:newsDlg&javax.faces.behavior.event=rowSelect&javax.faces.partial.event=rowSelect&newsForm:newsTable_instantSelectedRowKey=3 

login.xhtmlのXMLセクションの下

XML Parsing Error: no element found Location: moz-nullprincipal:{6ccf85cf-5c69-438c-a9bb-e66423a36a48} Line Number 1, Column 1: 

^

レスポンスコード

HttpServletResponse servResponse = (HttpServletResponse) response;     
servResponse.sendRedirect("login.xhtml"); 
servResponse.setHeader("Access-Control-Allow-Origin", "*"); 

答えて

0

私はdoRedirect方法でブログ記事の下部にあるため、関連するコードでこの質問in this blog

への答えを見つけました。

0

だけguess--

あなたがリダイレクトしようとしている場合あなたはajaxレスポンスから301/302スタイルではありません。あなたはブラウザにメッセージを送り返し、JavaScriptを使ってブラウザをリダイレクトする必要があります。

おそらく、非アヤックスのものは、301/302を使用しているために働いている可能性があります。

+0

上記の回答に私が使用しているコードを追加しました – Ryland

関連する問題