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