如何使用JSF设置HTTP状态代码? [英] How to set HTTP status code with JSF?

查看:154
本文介绍了如何使用JSF设置HTTP状态代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WebSphere Application Server上使用Apache Myfaces 2.2.

I use Apache Myfaces 2.2 on WebSphere Application Server.

我有一个JSF页面,可以测试"与文件系统和数据库的连接.

I have a JSF page, which "test" the conenction to filesystem and database.

当连接失败时,我想返回另一个HTTP状态代码. 如何使用JSF做到这一点?

When the connection fails, I want to return another HTTP Status Code. How can I do this with JSF?

推荐答案

尝试response.setStatus();

Try response.setStatus();

有关更多详细信息,此链接将很有帮助:

for more details this link will be helpful :

http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-Response-Status-Line.html

这篇关于如何使用JSF设置HTTP状态代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆