Hi Kevin,
 Is the vendor/version of servlet container is same for local and remote 
portlet deployment?? The PortletSession implementation actually uses 
ServletSession to store any attribute. Some Servlet container allows any 
non-serializable attribute to be set in the session and some doesn't. I 
believe, in your case, either the servlet container vendor or its version is 
different for local and remote deployment.

Regards
Manish.


Kevin Irmscher <[EMAIL PROTECTED]> wrote: Hi!

I'm developping a portlet and I want to use the PortletSession to pass
attributes between the Portlet and a JSP. This works perfectly when I
deploy the portlet locally (Pluto), but it doesn't when I access the
portlet through WSRP using WSRP4J (with Pluto) as producer.

Here's what I'm doing exactly:
1. invoke an actionURL in the JSP
2. processAction in the portlet will be called
3. set PortletSession attribute (the attribute is an object of MyClass)

    actionRequest.getPortletSession().setAttribute("myClass", new MyClass());

4. get MyClass object in JSP

    <%
 MyClass c = (MyClass)
renderRequest.getPortletSession().getAttribute("myClass");
    %>

5. display c.toString

   <% if (c != null) { %>  <%=c.toString()%> <%  } %>


It does work if the portlet is local but not when I consume it
remotely. That's why I assume it must have something to do with the
WSRP4J producer implementation. I don't get any error messages neither
on the consumer nor on the producer.

It is strange tough that if I use a String or an Integer object
instead of MyClass it even works with WSRP4J!

Any help would be appreciated,
Kevin

Here the code of the portlet:

public class SessionTestPortlet extends GenericPortlet {

 public void doView(RenderRequest request, RenderResponse response)
   throws PortletException, IOException {

  PortletContext context = getPortletContext();
  PortletRequestDispatcher disp = context.getRequestDispatcher("/jsp/"
    + "view.jsp");
  disp.include(request, response);

 }

 public void processAction(ActionRequest actionRequest,
   ActionResponse actionResponse) throws PortletException,
   java.io.IOException {

  actionRequest.getPortletSession()
    .setAttribute("myClass", new MyClass());
 }
}

Here the code of  view.jsp:

<%@ page session="true"%>
<%@ taglib uri="http://java.sun.com/portlet"; prefix="portlet"%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ page import="session.test.portlet.MyClass"%>




<%
MyClass c = (MyClass) renderRequest.getPortletSession().getAttribute("myClass");
%>

<%
if (c == null) {
%>


 [input] 
<% } else { %>
    <%=c.toString()%>
<% } %>


 
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.

Reply via email to