Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

portlet communication - sending object not string...

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we send any object other than string to one portlet from another portlet?

Thanks.
 
Mouli Velu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
you can pass the string message to the portlets in any of the portlet application. You can use DefaultPortletMessage interface for this.

But messages other than string can be passed to the same portlet application only. you can make use of PortletMessage interface for this.
I have done this in IBM Portlet API.
 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mouli Velu:
Hi,
you can pass the string message to the portlets in any of the portlet application. You can use DefaultPortletMessage interface for this.

But messages other than string can be passed to the same portlet application only. you can make use of PortletMessage interface for this.
I have done this in IBM Portlet API.


Could you please put some more details or code sample here. It will really help me a lot.

Thanks a lot.
 
Mouli Velu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is for passing string messages from one portlet to another.

public void messageReceived(MessageEvent event) throws PortletException {

PortletMessage message = event.getMessage();

if (message instanceof DefaultPortletMessage) {
String msgText = ((DefaultPortletMessage) message).getMessage();
event.getRequest().setAttribute("IsAnyMessage", msgText);
System.out.println("Inside MessageReceived, message = " + msgText);}
}

you can more details from the link below:
http://www-128.ibm.com/developerworks/websphere/library/techarticles/0402_konduru/0402_konduru.html
 
pooja jain
greenhorn
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by rathi ji:
Can we send any object other than string to one portlet from another portlet?

Thanks.


yes. session attribute in application scope will do, if portlets are in same war.

if not, use common place (db, xml).

also look for portlet wiring from ibm.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic