简体   繁体   English

门户/门户编程-门户链接/页面流

[英]Portal/portlets programming - portlet linking/page flow

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). 我正在编写我的第一个基于Portlet的应用程序(适用于liferay,但解决方案应与容器无关),并且我想知道人们如何解决为用户提供链接,从而“引导”到不同的Portlet(可能在门户网站的不同“页面”上) )。

While you can easily have different view modes inside your portlet, how can you link to another portlet and (maybe) also pass parameters along? 虽然您可以在portlet中轻松地拥有不同的查看模式,但是如何链接到另一个portlet并(也可以)传递参数呢?

I am not talking about plain communication between portlets, it's the real pageflow that interests me. 我并不是在谈论Portlet之间的简单通信,这才是我真正感兴趣的页面流。

Example: You have page A with a portlet that displays a list of news items. 示例:您的页面A带有显示新闻列表的portlet。 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) 然后,您已按照配置的方式创建了页面B,我希望显示一个新闻项(例如,围绕它的不同portlet)

Is there a generic solution to link to page B and say to the news-Detail-Portlet that it should show item XYZ? 是否有通用解决方案链接到页面B,并告诉news-Detail-Portlet它应显示项目XYZ?

The quick and dirty solution would be to configure the target link via edit mode of the news-list-portlet. 快速而肮脏的解决方案是通过新闻列表-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 但这有几个缺点:-复杂的Portlet可能具有多个目标URL,这导致门户网站管理员需要大量配置工作-这些URL可能不遵循允许简单参数注入的方案

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. 我有一个解决方案,但是这需要大量的努力,并且可能需要更改目标portlet,如果您使用3rd party portlet,这并非总是可能的。

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. Portlet会使用其Portlet ID在中央服务处注册,并且当Portlet想要链接到Portlet时,它可以基于符号名进行查找。 This would ease the pain for the admin, because it is possible to "auto discover" portlets. 这将减轻管理员的痛苦,因为可以“自动发现” portlet。 The service may also provide a UI to wire portlets based on source and target portlet. 该服务还可以提供一个UI,以基于源和目标Portlet连接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. 可以更改对portlet的URL的生成可以通过对portlet的服务调用来解决,该portlet生成带有注入参数的URL作为一个整体并返回它。 For portlets that you can't change you have to append the parameters and hope that it works. 对于无法更改的portlet,您必须附加参数并希望它能起作用。 :-/ : - /

Any suggestions? 有什么建议么? Are there simpler solutions? 有更简单的解决方案吗? existing solutions? 现有的解决方案?

Thanks! 谢谢!

Patrick 帕特里克

As far as I know Portlet Specification doesn't cover this. 据我所知,Portlet规范并未涵盖这一点。 So there is no portable solution. 因此,没有便携式解决方案。 For Liferay you can always use theirs custom tag library which aims exactly this issue. 对于Liferay,您始终可以使用针对此问题的自定义标签库。 There is similar mechanism for Websphere Portal. 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) 通常,我会尝试避免这种情况并使用标准的IPC机制(公共渲染参数或事件)

For JSR 286 specification it is possible to use events for inter-portlet communication. 对于JSR 286规范,可以将事件用于Portlet间的通信。 For the older JSR 168 there isn't an endorsed way to do so. 对于较旧的JSR 168,没有认可的方法。 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. 您可以在那里找到一些想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM