I have a portal page with 3 portlets developed following the JSR 168 specification standards. Now, I want to display the results of 1st portlet in 2nd portlet when a submit button is clicked on the first portlet. Is there any solution to achieve this ? All the portlets are developed using Spring porltet mvc framework, portal server is Vignette 7.2 and application server is weblogic 8.1.5. Thanks in advance.
This all depends on where the other portlet resides.
Two portlets in a common war file can share information through the PortletSession's APPLICATION_SCOPE. Portlets packaged in different war files cannot.
CBT Tutorial on How to Use the PortletSession's APPLICATION Scope
A single portlet can have several JSP pages associated with it. So, a portlet can get fed input from one JSP, and display results generated by a different JSP. This might accomplish your request a bit better. For more advanced, wizard like applications, you can always use the JSF Portlet or the Struts Portlet. I have some tutorials on how to create those in my signature links.
For portlets in separate war files, you can always write data to a database table in one, and have the other portlet read from that database table and generate the results. JDBC is available in all portlets. IBM has something called a PortletService that helps facilitate this process.
All of this though is a way of saying that really, it's not inherently possible to have one portlet display the results of the other portlet. Portlets are intended to be independed of each other. What if the user removed that second portlet from their page? You'd have one portlet taking in data, but no portlet to display the data. Does that make sense? Probably not.
Being a portlet developer requires a bit of a mind shift away from Servlets and JSPs. Start trying to think like a portlet developer, and you'll run into less of these issues.
Best of luck!
P M Rao
posted 12 years ago
Thanks a lot for your reply. To be more specific, All the 3 portlets are in the same war file.1st portlet is associated with 2 different jsp's.one jsp is having input fields and a submit button and the other jsp is for displaying the results. Now if i enter some values in the first jsp and click on submit button the 2nd jsp(results jsp) is displayed replacing the 1st jsp in the same place. But my requirement is, the results jsp has to be displayed in the 2nd portlet with 1st jsp in first portlet remains same even after submit button is clicked. To achieve this i hav set the values entered by the user in the 1st jsp of first portlet in the application scope. The setting of values into the application scope was done in controller of first portlet. Now i am able to access those values in the controller of 2nd porlet. With these values i called the web service deployed in a remote machine and was able to get the results in the 2nd portlet controller. Now my question is can i display those results in the jsp which is associated to this 2nd controller ?? can anyone please suggest how to do this ?? Please pass your advices if i am wrong with my approach. thanks in advance.