This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Portals and Portlets and the fly likes portlet communication - sending object not string... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "portlet communication - sending object not string..." Watch "portlet communication - sending object not string..." New topic
Author

portlet communication - sending object not string...

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Can we send any object other than string to one portlet from another portlet?

Thanks.
Mouli Velu
Greenhorn

Joined: Oct 06, 2005
Posts: 12
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.


Regards<br />S.Mouli
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
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

Joined: Oct 06, 2005
Posts: 12
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

Joined: Jan 12, 2005
Posts: 213
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.



:d
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: portlet communication - sending object not string...
 
Similar Threads
Sending an ArrayList using IBM Portlet Messaging
portlet session?
Redirecting or Forwarding to another Portlet with Params
Hiding a JBoss portlet
Portlet Communication: What is application scope, anyway?