如何在Struts2中设置页面以自动重定向错误的URL [英] how to set a page in Struts2 to automatically redirect the wrong urls

查看:76
本文介绍了如何在Struts2中设置页面以自动重定向错误的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将不正确的URL重定向到我的服务器到特定页面. 我怎样才能做到这一点?

I need to redirect the incorrect URL to my server to a specific page. how can I make that possible?

推荐答案

您可以在struts.xml中使用默认操作.请参阅 http://struts.apache.org/2. x/docs/action-configuration.html#ActionConfiguration-ActionDefault .

You can use default action for that in your struts.xml. See http://struts.apache.org/2.x/docs/action-configuration.html#ActionConfiguration-ActionDefault.

或者在Struts2中也有Unknown Handlers http://struts .apache.org/2.x/docs/unknown-handlers.html ,如果您需要更复杂的解决方案.

Or there is also Unknown Handlers in Struts2 http://struts.apache.org/2.x/docs/unknown-handlers.html if you need a more complex solution.

这篇关于如何在Struts2中设置页面以自动重定向错误的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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