如何在UrlMappings.groovy中避免使用Url格式的#号? [英] How does one escape the # sign in a Url pattern in UrlMappings.groovy?

查看:257
本文介绍了如何在UrlMappings.groovy中避免使用Url格式的#号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了维护一个项目中当前的Urls集合,我必须能够使用Url中的(井号)。由于某种原因,UrlMappings.groovy的这个项目中的英镑符号似乎没有正常工作。



是否有一个特殊的转义序列必须在 UrlMappings.groovy 中放置#个符号时使用?



我错过了一些原因,为什么不能使用磅标志? p>

在以下URL映射示例中,浏览器转到正确的页面,但pageName变量为null:

/ test / $ {urlName}#/ overview(controller:'test',action:'overview'){
pageName =overview
}


解决方案

我认为网址中#后的所有内容都会被处理浏览器的客户端尝试找到并滚动到该位置。



如果您转储包含磅字符的请求,您是否看到#后面的数据?


In order to maintain the current set of Urls in a project, I have to be able to use the # (pound sign) in the Url. For some reason the pound sign does not appear to work normally in this project for UrlMappings.groovy.

Is there a special escape-sequence that must be used when placing # signs in UrlMappings.groovy?

Am I missing some reason why one cannot use pound signs at all?

In the following URL Mapping example, the browser goes to the correct page, but the pageName variable is null:

"/test/${urlName}#/overview"(controller:'test', action:'overview') {
    pageName = "overview"
}

解决方案

I thought everything after # in the url would be treated on the client side of the browsers where it tries to find a and scroll to that location.

If you dump the request containing the pound char, do you even see the data behind #?

这篇关于如何在UrlMappings.groovy中避免使用Url格式的#号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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