组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年11月15日 下午6:14
RE: How to Changing JSF portlet View Page in doView or in any managed Bean David H Nebinger 2012年11月15日 下午7:21
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年11月15日 下午7:41
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年11月15日 下午9:19
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2012年11月20日 上午9:37
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年11月22日 下午7:46
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2012年11月24日 下午2:22
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年12月24日 上午12:00
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2012年12月26日 上午9:10
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年12月26日 下午8:41
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2012年12月27日 上午3:58
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年12月27日 上午9:17
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年12月27日 下午7:52
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013年1月8日 上午10:17
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012年12月28日 上午10:51
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013年1月8日 上午10:53
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013年1月10日 下午3:05
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2013年1月15日 上午1:03
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013年1月15日 上午11:09
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2013年1月18日 下午9:46
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013年1月19日 上午3:52
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2013年1月25日 上午6:50
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013年1月25日 上午6:55
Muhammad Taha
How to Changing JSF portlet View Page in doView or in any managed Bean
2012年11月15日 下午6:14
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

IM setting event portlet 1 managed bean, and taking value in Portlet2 action file, and setting that value in session and taking that in portlet 2 target bean, I can display that value in same page i.e /views/view.xhtml, But How can i display that value in other page eg. /views/view2.xhtml
David H Nebinger
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年11月15日 下午7:21
答复

David H Nebinger

等级: Liferay Legend

帖子: 6274

加入日期: 2006年9月1日

最近的帖子

Portlets have different portlet sessions. The session for portlet 1 is not the same as the session for portlet 2.

You need to find another mechanism (i.e. portlet IPC, etc.) to transfer the value.
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年11月15日 下午7:41
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

im not using portlet to portlet session.. im processing event created in portlet1 in portlet2 action using processEvent()..there im setting in session for invoking portlet 2 bean.
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年11月15日 下午9:19
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

inside portlet1 .xhtml file

<h:inputText value="#{helloBean.name}"></h:inputText>
<h:commandButton action="#{helloBean.set}" value="Add Entry" />

inside portlet1 managed bean

public void set(){
QName qName = new QName("http://liferay.com", "empinfo", "x");
ActionResponse response = (ActionResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.setEvent(qName, name);
}

inside portlet 2 action

public void processEvent(EventRequest request, EventResponse response)throws PortletException, IOException {
Event event = request.getEvent();
String value = (String) event.getValue();
request.getPortletSession().setAttribute("myvalue", value);
}

inside portlet 2 bean (some IpcBean)

public String ipcValue() {
PortletRequest req = (PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String myvalue=(String)req.getPortletSession().getAttribute("myvalue");
return myvalue;
}

inside portlet 2 view.xhtml

<h4>Welcome #{ipcBean.ipcValue()}</h4>

Its working for me.. I want to get value in some other eg. view2.xhtml....
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年11月20日 上午9:37
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

When you wrote:

I want to get value in some other eg. view2.xhtml


Do you mean that, when an event occurs, that you want to navigate from view1.xhtml to view2.xhtml and then display the received event payload in view2.xhtml?
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年11月22日 下午7:46
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

Yes Neil.. U r correct...
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年11月24日 下午2:22
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

I would recommend that you look at the jsf2-ipc-events-customers-portlet and jsf2-ipc-events-bookings-portlet demo portlets. They are designed to be used together on the same portal page. When you click on a customer in the customers portlet, it sends an event that is received by the bookings portlet. The bookings portlet then triggers a navigation-rule to fire because of the CustomerSelectedEventHandler.java class. This is a JSR 329 standard feature.
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年12月24日 上午12:00
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

Im unable to post new thread using my network....

How to change portlet page using a hidden method (<h:inputHidden > )... waiting for ur reply...
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年12月26日 上午9:10
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

Hi Muhammad,

When you wrote:
How to change portlet page


Do you mean navigating to a different JSF view within the same portlet, or navigating to a totally different Liferay Portal page URL? Also, is this still related to Events IPC?

Thanks,

Neil
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年12月26日 下午8:41
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

its different JSF view within the same portlet. When IPC Event is recieved it has to display a different page instead of page defined in portlet.xml
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年12月27日 上午3:58
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

Did you get an opportunity to try the jsf2-customers-portlet and jsf2-bookings-portlet that I mentioned earlier in this thread? The bookings portlet shows how to execute a navigation-rule -- I think this might be a good match for your requirement of navigating to a different JSF view when the event occurs.
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年12月27日 上午9:17
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

Thanks Neil & David. Its done. I've downloaded bookings-portlet using another network..
Im able to do with following code

In porltlet.xml

<init-param>
<name>javax.portlet.faces.bridgeEventHandler</name>
<value>EventHandler</value>
</init-param>

<init-param>
<name>com.liferay.faces.bridge.preferPreDestroy</name>
<value>false</value>
</init-param>

In EventHandler.java

public class EventHandler implements BridgeEventHandler{

public EventNavigationResult handleEvent(FacesContext facesContext, Event event) {
EventNavigationResult eventNavigationResult = null;
String eventName = event.getName().toString();

if (eventName.equals("applicationtrackingnumber")) {

String value=(String) event.getValue();
TargetMO targetMO= getTargetMO(facesContext);

targetMO.setValue(value);

String fromAction = null;
String outcome = "ipc.customerSelected";
eventNavigationResult = new EventNavigationResult(fromAction, outcome);
}

return eventNavigationResult;
}

protected TargetMO getTargetMO(FacesContext facesContext) {

String elExpression = "#{targetMO}";
ELContext elContext = facesContext.getELContext();
ValueExpression valueExpression = facesContext.getApplication().getExpressionFactory().createValueExpression(
elContext, elExpression, TargetMO.class);
return (TargetMO) valueExpression.getValue(elContext);
}
}

in FacesConfig.xml

<navigation-rule>
<navigation-case>
<from-outcome>ipc.customerSelected</from-outcome>
<to-view-id>/views/success.xhtml</to-view-id>
</navigation-case>
</navigation-rule>

Thanks.
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年12月27日 下午7:52
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

Hi Neil,

Navigation is working when both source and target portlets are on same page. but if when i put target portlet on another page Eventhandler is invoking but page navigation is not happening.

In source portlet im redirecting and setting event with the follow code

externalContext.redirect(portletURL.toString());
response.setEvent(qNameAppTrackingNumber, applicationTrackingNumber);
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月8日 上午10:17
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

Do you have the portlet.event.distribution property set to layout-set in your portal-ext.properties file?

Here is a description from the portal.properties file. Note that a "layout" means a portal page within a site, and "layout-set" means all portal pages within a site.
1    #
2    # Set this property to specify how events are distributed. If the value is
3    # "layout-set", then events will be distributed to all portlets contained in
4    # a layout set. If the value is "layout", then events will be distributed to
5    # all portlets that are present in a layout.
6    #
7    portlet.event.distribution=layout-set


Also, the following need to be set in order for the layout-set distribution feature to work:

1layout.default.p_l_reset=false
2tags.compiler.enabled=false
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2012年12月28日 上午10:51
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

yes i've already set that. but I don't know why its not working...
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月8日 上午10:53
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

I have reproduced the problem and just created FACES-1465 in order to track it to closure. Please click on the "watch" link in JIRA in order to stay informed on progress.
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月10日 下午3:05
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

This issue is now fixed and will appear in the GA3 release of Liferay Faces. See FACES-1465 for more info.
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月15日 上午1:03
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

I tried with EventPayloadWrapper ..but portlet page is not navigating after portal page redirect.

Do I need to wait for latest version of bridge-impl jar ?
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月15日 上午11:09
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

You would have to use liferay-faces-bridge-impl-3.1.2-ga3-SNAPSHOT.jar in order for it to work.

For testing in your environment, I would recommend that you download version 3.1.2-ga3-SNAPSHOT of the jsf2-ipc-events-customers-portlet and jsf2-ipc-events-bookings-portlet from the snapshot repository.
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月18日 下午9:46
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

Now its working for me Neil...emoticon
I had to use liferay-faces-util-3.1.2-ga3-SNAPSHOT.jar, liferay-faces-bridge-api-3.1.2-ga3-SNAPSHOT.jar along with liferay-faces-bridge-impl-3.1.2-ga3-SNAPSHOT.jar.

I used below code for getting portal page

DynamicQuery query = DynamicQueryFactoryUtil.forClass(PortletPreferences.class).add(PropertyFactoryUtil.forName("portletId").eq("Your Portlet Id"));
List<PortletPreferences> results = (List<PortletPreferences>) PortletPreferencesLocalServiceUtil.dynamicQuery(query);
for(PortletPreferences pre : results) {
Layout layout = LayoutLocalServiceUtil.getLayout(pre.getPlid());
if(currentGroupId==layout.getGroupId()) {
portletURL.append(layout.getFriendlyURL());
break;
}
}
externalContext.redirect(portletURL.toString());

Thanks.
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月19日 上午3:52
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

I'm so glad to hear that it's working emoticon

Regarding getting the portal page, there is a contextual class called ThemeDisplay that has lots of getter methods on it that will help you.

You can get it like this in a backing bean:
1FacesContext facesContext = FacesContext.getCurrentInstance();
2ThemeDisplay themeDisplay = (ThemeDisplay) facesContext.getExternalContext.getRequestMap().get(WebKeys.THEME_DISPLAY);


Or if you are using the liferay-faces-portal.jar dependency, you can do this:
1LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
2ThemeDisplay themeDisplay = liferayFacesContext.getThemeDisplay();


In order to get the base URL for the portal, you can call methods like PortalUtil.getPortalURL(PortletRequest);
Muhammad Taha
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月25日 上午6:50
答复

Muhammad Taha

等级: Junior Member

帖子: 65

加入日期: 2012年5月1日

最近的帖子

Thanks Neil.
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013年1月25日 上午6:55
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 1997

加入日期: 2005年7月26日

最近的帖子

My pleasure.