Liferay portlet 可以获取参数吗?

发布于 2024-09-07 01:30:02 字数 208 浏览 7 评论 0原文

我无法理解 CMS 中 portlet 的概念。

假设我编写了一个天气 portlet 来显示当前温度。我构建它,将其打包到战争中,然后在 Liferay 中部署战争。

现在我创建了一个页面,并且我想创建我编写的 portlet 的 2 个实例。我想显示西雅图和迈阿密的天气。

我可以这样做吗?如何向 portlet 传递一个参数来告诉它要显示哪个城市?

I am having trouble understanding the concept of portlets in a CMS.

Let's say I write a weather portlet to display current temperature. I build it, package it in a war, deploy the war in Liferay.

Now I created a page, and I want to create 2 instances of the portlet I wrote. I want to display the weather in Seattle and the weather in Miami.

Can I do this? How do I pass the portlet a parameter to tell it which city to display?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

复古式 2024-09-14 01:30:02

Portlet具有所谓的编辑模式。您可以实现编辑模式来显示表格来选择要显示哪个城市的温度。将其保存到 portlet 首选项中。当您以正常 (VIEW) 模式呈现 portlet 时,请查看城市的首选项。

Portlet has so-called EDIT-mode. You can implement EDIT mode to show the form to choose which city you want to show the temperature for. Save this to portlet preferences. And when you will render the portlet in normal(VIEW) mode, look at the preferences for the city.

橘味果▽酱 2024-09-14 01:30:02

另一个选项是 PortletConfig - 通常在 portlet.xml 中配置,类似于 Servlet init params。偏好可能是您最好的选择。

特别是如果您使用 Liferay,LR 的模型构建器基础设施将为您提供许多此类功能,包括以跨容器可移植性为代价的快速/廉价编辑。从好的方面来说,它将与 LR 的(有限的)RBAC 很好地集成,这在分布式内容创作环境中往往很重要

Another option is PortletConfig - which is generally configured in portlet.xml and is similar to Servlet init params. Preferences is probably your best bet.

If you're working in Liferay in particular, LR's model-builder infrastructure will get you much of this functionality including editing quick/cheap at the cost of cross-container portability. On the plus side it will integrate well with LR's (limited) RBAC which tends to be important in distributed content authoring environments

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文