使用UrlRewrite在JSP中替换URL字符 [英] URL characters replacement in JSP with UrlRewrite

查看:93
本文介绍了使用UrlRewrite在JSP中替换URL字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 JSP 中使用 UrlRewrite >在 JBoss 上进行项目.我已经配置了一些规则,所以像这样的东西:

I am using UrlRewrite in a JSP project over JBoss. I have configured some rules, so that stuff like:

http://mysite/parameter

读取为:

http://mysite/index.jsp?parameter=parameter

以此类推.

现在,我想知道是否有一种方法可以将用户在URL中提交的某些字符替换为其他字符.类似于Wikipedia所做的事情.当您在WikiPedia中的URL中使用空格时,将其替换为-".

Now, what I would like to know if there's a way to replace certain characters submitted in the URL by the users with others. Something like what Wikipedia does. When you use a space in the URL in WikiPedia, it's replaced by a "-".

Url是否为此重写了正确的工具?我周围也有一些过滤器,但是我想我应该能够使用UrlRewrite或类似的工具来完成此操作.

Is UrlRewrite the right tool for this? I also have a few filters around, but I guess I shoul be able to accomplish this with UrlRewrite or a similar tool.

推荐答案

万一有人需要做同样的事情,我已经

In case anyone needs to do this same thing, I've found out it's possible using Servlets to filter URLs, response.sendRedirect() and request.getRequestDispatcher().forward().

这篇关于使用UrlRewrite在JSP中替换URL字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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