从钩子中包含 Liferay 门户 jsp
我的问题是关于 Liferay hooks 和 portlet 6.0。
我对 jsp 的钩子覆盖了 liferay portlet 的钩子。例如 document_library/view.jsp - 经过测试 - 工作正常。 (我设置了 custom-jsp-dir 等)
现在我想在这个钩子中创建我的 portlet,最后呈现钩子的 document_library/view.jsp。
但我收到错误:
org.apache.jasper.JasperException: /WEB-INF/html/portlet/document_library/view.jsp(17,1) File "/html/portlet/document_library/init.jsp" not found
我没有创建 init.jsp - 我希望这个钩子使用 Liferay document_library 原始钩子。
你能帮助我吗?
我也在这里问 http://www.liferay.com/community/forums //message_boards/message/9583788
谢谢
my question is about Liferay hooks and portlets 6.0.
I have hook with jsps overiding liferay portlet ones. e.g. document_library/view.jsp - tested - works fine. (I have custom-jsp-dir set etc )
Now I want to create my portlet in this hook, which at the end renders hook's document_library/view.jsp.
But I get error:
org.apache.jasper.JasperException: /WEB-INF/html/portlet/document_library/view.jsp(17,1) File "/html/portlet/document_library/init.jsp" not found
I didn't create init.jsp - I want this hook to use Liferay document_library original one.
Can you help me?
I asked also here http://www.liferay.com/community/forums/-/message_boards/message/9583788
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的回答:你不能。
原因:来自 hooks custom-jsp 目录的 JSP 将被复制到门户 - 因此它们将在 liferay 的类加载器中运行。然而,您的 portlet 将在您的插件的类加载器中运行,因此无法访问 liferay 的 jsps。
挂钩中的 JSP(那些被声明为门户的自定义 jsp 的 JSP)不能在同一插件中的 portlet 中使用。这是设计使然,除了将它们复制到 portlet 可以访问它们的路径之外,您无法解决此问题。
作为最佳实践,我建议创建一个用于修改 Liferay 的钩子和一个带有新(附加)portlet 的单独 portlet 插件。使 portlet 独立。在某些情况下,将钩子和 portlet 结合起来会很好,但我最喜欢将修改和添加分开。
Short answer: You can't.
Reason: JSPs from a hooks custom-jsp directory will be copied over to the portal - thus they will run in liferay's classloader. Your portlet however will run in your plugin's classloader, thus have no access to liferay's jsps.
JSPs in hooks (those that are declared as custom-jsps for the portal) cannot be used from portlets in the same plugin. This is by design, you can't work around this other than through copying them to a path where your portlet can reach them.
As a best practice, I'd advise to create a hook for modifications to Liferay and a separate portlet plugin with new (additional) portlets. Make the portlets self-contained. There are situations where it's good to combine hooks and portlets, but I like it best if modifications and additions are kept apart.