English 中文(简体)
无法将反向 URL 映射变量传送到远程功能
原标题:No way to pass variables for reverse url mappings to remoteFunction
  • 时间:2012-05-25 05:57:22
  •  标签:
  • grails

假设我有一个 URL 映像图

“博客/美元/月/月/美元/日”(控制者:博客)

我不可能把年、月、月、日的数值 传给远程功能 让它产生适当的URL

没有变量, 默认规则会匹配并生成 URL 会像“ / 控制器/ 动作 ” (/ controller/ action) 我知道我可以把参数传送到远程功能中, 所以输入的 URL 会匹配规则, 但是相反的 URL 映射会怎么样? 用于生成 ajax 终点的 URL 。

有什么解决办法吗?

问题回答

如果您正在寻找一种方法将URL映射的参数放入远程功能()调用中, 轨迹手册上说, 在收到请求后, 可以通过访问控制器中的参数映射来做到这一点 :

static mappings = {
   "/$blog/$year/$month/$day/$id"(controller: "blog", action: "show")
}

"The individual tokens in the URL would again be mapped into the params object with values available for year, month, day, id and so on."

http://grails.org/doc/latest/guide/theWebLayer.html#urlmappings" rel=“nofollow'>http://grails.org/doc/lat/guide/theWebLayer.html#urlmappings





相关问题
grails + gwt request handling via controllers

I am new to gwt. I am trying to integrate gwt+grails.Can anybody provide me a good example for handling the request using grails controllers and not a custom servlet.I will be really thankful if ...

Error loading the grails gwt module xml

I ve installed the plugin from this article by Peter http://www.cacoethes.co.uk/blog/groovyandgrails/the-command-pattern-w.... While compile time its not able to find the module file which is present ...

Sorting Objects Based on Custom Domain Class Methods

I have a domain class, in which I ve defined some methods which give the object a score based on different algorithms (eg. popularity). I now want to retrieve a list of these objects sorted by one of ...

Grails Packaging and Naming Conventions

Packaging Controllers, Services,etc. i.e. - com.company.controllers - com.company.services Is this a good practice or should be avoided by all means?? Another worth mentioning problem I encountered ...

Hibernate/GORM: collection was not processed by flush()

I have an integration test in my Grails application that fails when I try to save an entity of type Member invitingMember.save(flush: true) This raises the following exception org.hibernate....

热门标签