Murthy,

Make sure:

1) Portlet#B and Portlet#A are part of the same WAR file.  You can only
share attributes within the same portlet application.

2) The render method is called before the processAction method.  Usually,
the roles of the portlets would be reversed; you set session attributes in
the action and display them in the render phase.  The render phase should
be idempotent remember; it should not be changing application state.

Also, it is a really BAD thing when you start passing request objects to
other threads (i.e., don't put the request's PrintWriter into the session,
thereby making it accessible to other threads).  I know this was just an
example, but it could possibly lead to unexpected problems.

Thanks,

Ben

> In my attempt to push content into portlet#B from portlet#A I have tried
> to use the session by following the suggestions given at
> http://allu.wordpress.com/category/portlets/
>
>
> Here is my code in the render method of HelloWorld portlet
>
> public void render(javax.portlet.RenderRequest request,
> javax.portlet.RenderResponse response) {
>         response.setContentType("text/html");
>         PrintWriter writer=null;
> try{
>         writer=response.getWriter();
>         response.getWriter().println("Helloy2z Portlet" + writer);
> } catch (Exception e) {};
>         request.getPortletSession().setAttribute("writer", writer,
> PortletSession.APPLICATION_SCOPE);
>         request.getPortletSession().setAttribute("hello", "there234",
> PortletSession.APPLICATION_SCOPE);
>         PortletContext context = getPortletConfig().getPortletContext();
>        context.setAttribute("hello2", "amen");
> }
>
> Here is the code in the processAction method of Portlet#B
>
> PortletContext context = getPortletConfig().getPortletContext();
>       String a=(String) context.getAttribute("hello2");
>
> PrintWriter
> pw=(PrintWriter)request.getPortletSession().getAttribute("writer",
> PortletSession.APPLICATION_SCOPE);
>
> String h = (String) request.getPortletSession().getAttribute("hello",
> PortletSession.APPLICATION_SCOPE);
>
>
> All a, h and pw are coming out as null.
>
> What am I doing wrong here?
>
> Thanks
> Murthy
> -----Original Message-----
> From: Murthy Gandikota
> Sent: Wednesday, October 17, 2007 2:28 PM
> To: Murthy Gandikota; '[email protected]'
> Subject: RE: Pluto 1.1.4 - java.lang.InstantiationException while
> deploying
>
> I have learnt my lesson with HTML frames. They are only support by IE.
> Frames suck!
>
> So this got me to thinking, how can I click on some link in Portal#1 and
> change the appearance of Portal#2? So far I have no answers. Can someone
> show me a hello world example, where clicking a helloworld link on
> Portal#1 displays the text hello world in Portal#2?
>
> Thanks for your help
> Murthy
>
> -----Original Message-----
> From: Murthy Gandikota
> Sent: Thursday, September 06, 2007 9:26 AM
> To: [email protected]
> Subject: RE: Pluto 1.1.4 - java.lang.InstantiationException while
> deploying
>
> I could make my helloworld work after adding the page in the admin screen.
> Wonder why no one mentioned that :-)
>
> What is the difference between frames and containers? It seems whatever
> is displayed on the Pluto portal can be done with frames. Am I missing
> something? Can we layer containers one top of another?
>
> Coming from a Tomcat 5.5.3 and JSP/Servlet background, Pluto 1.1.4 is
> much better. So please don't get me wrong.
>
> I'd appreciate if someone could answer my questions.
>
> Thanks
> Murthy
>
> -----Original Message-----
> From: Murthy Gandikota [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 04, 2007 8:05 PM
> To: [email protected]
> Subject: RE: Pluto 1.1.4 - java.lang.InstantiationException while
> deploying
>
> I followed the steps indicated by
> a) http://www.ociweb.com/jnb/jnbAug2006.html
> b) http://portals.apache.org/pluto/v11/deploying.html
>
> Successfully created the war file with maven and deployed without errors
>
> I still see the exception given below.
>
> The URL given in (a) uses JetSpeed2. Do I need that too?
>
> Thanks
> Murthy
> -----Original Message-----
> From: Murthy Gandikota [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 04, 2007 6:22 PM
> To: [email protected]
> Subject: RE: Pluto 1.1.4 - java.lang.InstantiationException while
> deploying
>
> Ben Wrote:
>>Probably the problem that you are having is related to:
>
>>>       <servlet-class>javax.portlet.GenericPortlet
>>>       </servlet-class>
>
>>This is in an incorrect way to map the servlet.  This class should be
>>org.apache.pluto.core.PortletServlet.
>
> With the change done as suggested above the error now is:
>
> SEVERE: Servlet.service() for servlet HelloWorld threw exception
> java.lang.NullPointerException
>         at
> org.apache.pluto.core.PortletServlet.dispatch(PortletServlet.java:196)
>         at
> org.apache.pluto.core.PortletServlet.doGet(PortletServlet.java:145)
>
> I think the exception in the dispatch is because the following session
> variables are not set:
>
> javax.portlet.response
> javax.portlet.request
> org.apache.pluto.core.method
>
> The relevant code from PortletServlet.java
>
> // Retrieve attributes from the servlet request.
>         Integer methodId = (Integer) request.getAttribute(
>             Constants.METHOD_ID);
>
>         portletRequest = (InternalPortletRequest) request.getAttribute(
>             Constants.PORTLET_REQUEST);
>
>         portletResponse = (InternalPortletResponse) request.getAttribute(
>             Constants.PORTLET_RESPONSE);
>
>
> I'd appreciate some more help. May be someone can post the web.xml that
> works!
>
> Thanks
> Murthy
>


Reply via email to