惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
美团技术团队
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
月光博客
月光博客
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
J
Java Code Geeks
博客园_首页
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
Vercel News
Vercel News
博客园 - 聂微东

博客园 - 不明飞行物

磨刀不误砍柴工-打造超级Symbian开发环境 Symbian OS 开发初级手册 (8) 多线程 Symbian OS 开发初级手册 (7) Descriptors - 不明飞行物 Symbian OS 开发初级手册 (6) CleanupStack and Two-phase Symbian OS 开发初级手册 5 - Leave Symbian OS 开发初级手册 (4) mmp, pkg 文件 和 makesis 工具 Symbian OS 开发初级手册 (3)GUI程序中的4个基本类 Symbian OS 开发初级手册 (2)基本数据类型 Symbian OS 开发初级手册 (1) Introduction 利用JavaMail收/发Gmail邮件(SSL) Tapestry4在提交前判断checkbox是否没有一个被选中 - 不明飞行物 - 博客园 恢复windows的引导程序 在页面中插入Windows Media Player播放器 - 不明飞行物 Java中Set的深入研究 - 不明飞行物 - 博客园 Hibernate和Spring的延迟加载和DAO模式 用spring管理hibernate事务时,lzay="true"不能用的解决方法 java中List和Set对象的互换 Tapestry4.0中取得页面request - 不明飞行物 - 博客园 validators里自定义错误信息 - 不明飞行物 - 博客园
Logout in tapesty4.0 - 不明飞行物
不明飞行物 · 2006-01-06 · via 博客园 - 不明飞行物

link:http://wiki.apache.org/jakarta-tapestry/LogoutLinkTap4?highlight=%28logout%29

Simple Answer

Use a ServiceLink to the RestartService in your page(.html).

    <span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESTART_SERVICE">Logout</span>

This will save on writing extra classes if you don't need them, but stops you from doing other things in your listener without wrapping the Restart Service (like logging a message, giving the user the option to not logout?, etc).

Listener Approach (for versions up to beta-12)

Firstly, you will need to define a listener method in your page (or component) class, and a LinkFactory getter.

public abstract IEngineService getRestartService();

public ILink logout(IRequestCycle cycle)
{
    // do your own cleanup here

    return getRestartService.getLink(cycle, false, null);
}

Then, in your .page (or .jwc), inject the LinkFactory :

    <inject object="engine-service:restart" property="restartService" />

Thirdly add the listener to your link:

   <span jwcid="@DirectLink" listener="listener:logout">Logout</span>

Listener Approach (for versions later than beta-12)

Due to changes to the getLink parameters that occured in beta-13, your logout method should now be:

public ILink logout()
{
    // do your own cleanup here

    return getRestartService.getLink(false, null);
}

Note that since we don't need the IRequestCycle in order to generate the ILink, we don't need to include it in our listener either.