使用UrlRewrite在JSP中替换URL字符

编程入门 行业动态 更新时间:2024-10-24 22:20:35
本文介绍了使用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:

mysite/parameter

读取为:

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.

推荐答案

万一有人需要做同样的事情,我已经发现使用Servlets 可以过滤URL,response.sendRedirect()和request.getRequestDispatcher().forward().

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字符

本文发布于:2023-11-01 02:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547992.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符   UrlRewrite   JSP   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!