views:

82

answers:

1

Is there any way too find out the current view (or gsp file) that is being executed?

RequestURI doesn't work due to URL Mappings and forwards.

I'm trying to retrieve resources dynamically based on the currently executing GSP file. For example, if product/view.gsp is being executed, I want to include product/view.css and product/view.js (if they exist). The part that I'm having a problem with is getting the text "view"

+2  A: 

A gsp page is compiled into a class derived from org.codehaus.groovy.grails.web.pages.GroovyPage. You can get the whole pathname of the gsp file with ${this.getGroovyPageFileName()}, or just ${groovyPageFileName}. You'll have to trim off the path information yourself.

ataylor