フォーラム

ホーム » Liferay Portal » English » 2. Using Liferay » General

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012/11/15 18:14
RE: How to Changing JSF portlet View Page in doView or in any managed Bean David H Nebinger 2012/11/15 19:21
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012/11/15 19:41
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012/11/15 21: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 19:46
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2012/11/24 14:22
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2012/12/24 0: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 20: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 19:52
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013/01/08 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/01/08 10:53
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013/01/10 15:05
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2013/01/15 1:03
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013/01/15 11:09
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2013/01/18 21:46
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013/01/19 3:52
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Muhammad Taha 2013/01/25 6:50
RE: How to Changing JSF portlet View Page in doView or in any managed Bean Neil Griffin 2013/01/25 6:55
Muhammad Taha
How to Changing JSF portlet View Page in doView or in any managed Bean
2012/11/15 18:14
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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 19:21
答え

David H Nebinger

ランク: Liferay Legend

投稿: 5738

参加年月日: 2006/09/01

最近の投稿

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 19:41
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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 21:19
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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

投稿: 1855

参加年月日: 2005/07/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 19:46
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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 14:22
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1855

参加年月日: 2005/07/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 0:00
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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

投稿: 1855

参加年月日: 2005/07/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 20:41
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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

投稿: 1855

参加年月日: 2005/07/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

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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 19:52
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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/01/08 10:17
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1855

参加年月日: 2005/07/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

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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/01/08 10:53
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1855

参加年月日: 2005/07/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/01/10 15:05
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1855

参加年月日: 2005/07/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/01/15 1:03
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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/01/15 11:09
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1855

参加年月日: 2005/07/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/01/18 21:46
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

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/01/19 3:52
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1855

参加年月日: 2005/07/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/01/25 6:50
答え

Muhammad Taha

ランク: Junior Member

投稿: 59

参加年月日: 2012/05/01

最近の投稿

Thanks Neil.
Neil Griffin
RE: How to Changing JSF portlet View Page in doView or in any managed Bean
2013/01/25 6:55
答え

Neil Griffin

LIFERAY STAFF

ランク: Liferay Legend

投稿: 1855

参加年月日: 2005/07/26

最近の投稿

My pleasure.