2

当用户会话过期时,如何更改 Tapestry 4 显示的页面?

4

2 回答 2

3

Ah, the old days, Tapestry 4...

I think there were different ways..

  • just name the page you want to display "StaleSession.html", or

  • put something in your app.application file.. like

    <page name="StaleSession" specification-path="tapestry/page/StaleSession.page"/>

or

  • put something in your hivemodule.xml, like

<contribution configuration-id="tapestry.InfrastructureOverrides"> <property name="staleSessionPageName" value="MyStaleSessionPage" /> </contribution>

hth

于 2009-06-19T13:30:08.780 回答
0

如果您需要检查用户是否登录或类似的东西,您可以在您的访问对象中设置一个属性,并在validate(IRequestCycle cycle)您的页面的方法中检查它。如果有多个页面,则为没有用户登录时要重定向的所有页面创建一个超类,并在超类中实现该方法。请记住,每当您调用时,getVisit()如果没有任何实例,您都会获得一个新实例,因此您需要在您的访问对象中设置一个属性以查看会话是否有效。

于 2009-05-18T22:39:36.710 回答