Portlet可以获取参数吗

Portlet可以获取参数吗

本文介绍了Liferay Portlet可以获取参数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

比方说,我写了一个天气Portlet来显示当前温度.我制造它,将它包装在战争中,然后将战争部署在Liferay中.

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.

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

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.

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

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

推荐答案

Portlet具有所谓的EDIT模式.您可以实施EDIT模式以显示表单,以选择要显示温度的城市.将其保存到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.

  • http://portals.apache.org/pluto/portlet-api/apidocs/javax/portlet/PortletPreferences.html
  • http://onjava.com/pub/a/onjava/2006/02/01/what-is-a-portlet-2.html?page=2

这篇关于Liferay Portlet可以获取参数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 23:24