grails - grails无法从插件中找到视图
问题描述
我正在尝试编写一个可以查看文件的 grails 插件。实际上,我只是想在这里升级这个...... https://github.com/intelligrape/File-Viewer-Grails-Plugin到 grails4,并让它在我的应用程序中运行。
无论如何,在我让它在应用程序中运行后,我访问 http://localhost:8080/file/index 并收到此错误:
URI
/file/index
Class
javax.servlet.ServletException
Message
Could not resolve view with name '/plugins/file-explorer-0.1/file/fileList' in servlet with name 'grailsDispatcherServlet'
当控制器执行此操作时会发生这种情况...
def index(String filePath) {
Map model = [locations: fileLocations.locations]
// blah blah
render(view: "/file/fileList", model: model, plugin: 'fileExplorer')
}
调用了 render() 方法(我在调试器中检查了)。我也尝试删除 plugin: 参数,但没有任何区别。
现在,如果我将插件作为独立应用程序运行(通过转到该文件夹并运行“grails run-app”,那么它会按预期工作,并且 http://localhost:8080/file/index 会呈现视图预计。
这一切都让我相信插件基本上可以工作并安装到我的应用程序中,除了视图组件,无论出于何种原因,它都无法从插件中找到视图。
如果您想知道源代码的样子,基本上就是您在此处看到的内容:.. https://github.com/intelligrape/File-Viewer-Grails-Plugin 除了我已将其从 FileViewer 重命名为 FileExplorer。
我正在使用 grails 4.1.0.M5 我不知道这是否可能是此版本中的错误或什么。
解决方案
It seems that I should have had
plugin: 'filexplorer'
instead of
plugin: 'fileExplorer'
I could have sworn I tried this already. I guess the thing is it can be confusing which name to use where as far as plugins, as in the build.gradle name, the name in the *Plugin.groovy, the name in settings.gradle, the package name etc. Anyway, somehow I screwed up.
推荐阅读
- android - Android中的虚拟合成器(基于jar) - 原生jni?
- linux - 错误:httpd24-tools 与 httpd-tools-2.2.34-1.16.amzn1.x86_64 冲突
- python - 如何从 Django InMemoryUploadedFile 解析 pdf?
- javascript - React-native:除非更改状态,否则绝对定位的组件不会完全渲染
- r - 我们可以在 Rblogdown 网页中创建参考链接吗
- javascript - 如何将事件添加到子组件?
- objective-c - 如何将 OpenGLES 着色器转换为与 Metal 兼容的着色器?
- php - Woocommerce 追加销售 CSV - 为什么它有时只工作?
- azure-data-factory - Azure VM 上 SQL Server 的 IR 设置
- jquery - 检查单选按钮是否具有列表中的值