この回答で説明されているViewHandlerで JSF 1.2 を使用してきました。問題は、JSF 2.0 と互換性がないことです。JSF 2.0または代替で機能させる方法を知っている人はいますか?
編集 :
私はこの解決策を見つけました: Stateless JSFViewHandler
、しかし、JSF 1.2で行っていたのと同じようにそれを行う方法があるかどうかはまだ疑問に思っています。これが私のJSF 2.0の現在のコードです:
public class AutoRegeneratorViewHandler extends GlobalResourcesViewHandler
{
public AutoRegeneratorViewHandler(ViewHandler viewHandler)
{
super(viewHandler);
}
@Override
public UIViewRoot restoreView(FacesContext p_oContext, String p_sViewID)
{
UIViewRoot oViewRoot = super.restoreView(p_oContext,p_sViewID);
try
{
if(oViewRoot == null)
{
initView(p_oContext);
oViewRoot = createView(p_oContext,p_sViewID);
p_oContext.setViewRoot(oViewRoot);
try
{
renderView(p_oContext,oViewRoot);
}
catch(IOException e)
{
e.printStackTrace();
}
System.out.println("Created : " + p_sViewID);
}
}
catch(Exception e)
{
e.printStackTrace();
}
return oViewRoot;
}
}
このコードはを取り除きViewExpiredException
ますが、ページが読み込まれると、ログに記録されていないように見えます。
テストケース :
- ウェブサイトを開く
- 現在のセッションの有効期限よりも長く待機します (から
web.xml
) - ユーザー名/パスワードを入力してください
- ログインボタンを押す
- ログインフォームが空でページがリロードされる
- ページをリロードする
- ページの表示 ウェルカム フォームとログイン フォームが表示されない (予期される動作)