Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个自定义标签库,我想知道是否可以获得调用自定义标签的文件的文件名?我需要该标签的行为不同,具体取决于哪个文件调用它以及我是否可以获得最佳方法的名称。否则我只需要传递参数来告诉它如何表现。
您始终可以从参数中访问控制器和操作名称。
${params.action} ${params.controller}
甚至
${actionName} ${controllerName}
不确定这是否会有所帮助,但也有请求的 URI。
${request.forwardURI}
最后,从调用 GSP 获取实际文件名(带路径),您可以使用:
${this.getGroovyPageFileName()}