Portal/portlet 编程 - portlet 链接/页面流

发布于 2024-07-17 11:24:37 字数 1005 浏览 10 评论 0原文

我正在编写我的第一个基于 portlet 的应用程序(对于 liferay,但解决方案应该与容器无关),我想知道人们如何解决向用户提供“引导”到不同 portlet 的链接(可能在门户中的不同“页面”上) )。

虽然您可以轻松地在 Portlet 中拥有不同的视图模式,但如何链接到另一个 Portlet 并(也许)传递参数呢?

我不是在谈论 portlet 之间的简单通信,而是我感兴趣的真实页面流。

示例: 您的页面 A 带有一个显示新闻项目列表的 portlet。 然后您有按照配置方式配置的页面 B 我希望显示单个新闻项(例如围绕它的不同 portlet)

是否有一个通用的解决方案可以链接到页面 B 并对新闻详细信息 Portlet 说它应该显示项目 XYZ?

快速但肮脏的解决方案是通过 news-list-portlet 的编辑模式配置目标链接。 但这有几个缺点: - 复杂的 portlet 可能有多个目标 URL,这会导致门户管理员需要进行大量的配置工作 - url 可能不遵循允许简单参数注入的方案

我心中有一个解决方案,但这需要付出巨大的努力,并且可能需要对目标 portlet 进行更改,如果您使用第 3 方 portlet,则这并不总是可能的。

我的解决方案如下所示:(草稿!)

Portlet 使用其 Portlet ID 在中央服务中注册,当 Portlet 想要链接到 Portlet 时,它可以根据符号名称进行查找。 这将减轻管理员的痛苦,因为可以“自动发现”portlet。 该服务还可以根据源和目标 portlet 提供 UI 来连接 portlet。

可以更改的 Portlet 的 URL 生成可以通过对 Portlet 的服务调用来解决,该服务调用生成具有注入参数的整体 URL 并返回它。 对于无法更改的 portlet,您必须附加参数并希望它能够正常工作。 :-/

有什么建议么? 有更简单的解决方案吗? 现有的解决方案?

谢谢!

帕特里克

I am writing my first portlet based application (for liferay, but the solution should be container agnostic) and I am wondering how people solve to provide links to the user that "lead" to different portlets (maybe on different "pages" in the portal).

While you can easily have different view modes inside your portlet, how can you link to another portlet and (maybe) also pass parameters along?

I am not talking about plain communication between portlets, it's the real pageflow that interests me.

Example:
You have page A with a portlet that displays a list of news items. Then you have page B that is in the way configured I'd like a single the news item to be shown (for example different portlets around it)

Is there a generic solution to link to page B and say to the news-Detail-Portlet that it should show item XYZ?

The quick and dirty solution would be to configure the target link via edit mode of the news-list-portlet. But this has several disadvantages:
- complex portlets may have several target URLs which leads to massive configuration efforts for the portal admin
- the urls may not follow a scheme that allows simple parameter injection

I have a solution in mind, but this would require massive efforts and maybe changes in the targeted portlets, which is not always possible if you use 3rd party portlets.

My solution would look like this: (draft!)

Portlets register at a central service with their portlet IDs and when a portlet wants to link to a portlet it can do a lookup based on a symbolic name. This would ease the pain for the admin, because it is possible to "auto discover" portlets. The service may also provide a UI to wire portlets based on source and target portlet.

The URL generation for portlets that can be changes may be solved via service call to the portlet that generates the URL as a whole with injected parameters and returns it.
For portlets that you can't change you have to append the parameters and hope that it works. :-/

Any suggestions? Are there simpler solutions? existing solutions?

Thanks!

Patrick

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

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

发布评论

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

评论(2

客…行舟 2024-07-24 11:24:37

据我所知,Portlet 规范并未涵盖这一点。 所以没有便携式解决方案。 对于 Liferay,您始终可以使用他们的自定义标签库,该库正是针对这个问题。 Websphere Portal 也有类似的机制。

可以在此处这里

一般来说,我会尽量避免这种情况并使用标准 IPC 机制(公共渲染参数或事件)

As far as I know Portlet Specification doesn't cover this. So there is no portable solution. For Liferay you can always use theirs custom tag library which aims exactly this issue. There is similar mechanism for Websphere Portal.

Something can be found here and here

Generally I would try to avoid this and use standard IPC mechanism(Public Render Parameters or Events)

指尖凝香 2024-07-24 11:24:37

对于 JSR 286 规范,可以使用事件进行 portlet 间通信。 对于较旧的 JSR 168,没有经过认可的方法来执行此操作。 如果您找到适合您的方法,请使用它。

Manning 免费赠送一本旧书(需要注册)。 您可以在那里找到一些想法。

For JSR 286 specification it is possible to use events for inter-portlet communication. For the older JSR 168 there isn't an endorsed way to do so. If you find a way that works for you, then use it.

There is an old book given away for free from Manning (registration required). You can find some ideas there.

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