You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by nick the mytilian <at...@csd.uoc.gr> on 2003/03/29 18:58:02 UTC

Jsp Portlet Problem.

Hi,

I am facing the following problem:
I use the JspPortlet to present the output of a JSP in a portlet.
I want to "put" a String in the context, so that another portlet
can get it.
Unfortunately, i see that the only way to use something like:
String lala = (String) rundata.getSession().getAttribute("Testing");
context.put("testing",lala);

is to  implement a portlet with action that extends the
VelocityPortletAction.

BUT: I do not want to use Velocity! (I have already written the code in
JSP)

How can i put something in the Context, using the JspPortlet and not the
VelocityPortlet?

Thanks in advance!

Nikos.


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Re: Jsp Portlet Problem.

Posted by Todd Kuebler <tk...@cisco.com>.
Do you want _another_ portlet to get the string, or are you talking about 
having an action put something in the context and the jsp picking it 
up?   The second case is handled by the GenericMVCPortlet.  The first case 
is a little tricker.

If you are needing 'inter-portlet communication' you could use the session 
object (via org.apache.jetspeed.util.PortletSessionState
), write a turbine service or use an intermediary like an ejb to manage 
your shared data for you.  The obvious drawback to this approach is that 
other portlets may not have access to this new information until the next 
request ( depending on were they are in the page rendering cycle relative 
to the portlet action that is placing the information in the data 'cart' ).

There really isn't a good solution for this that I have discovered, please 
correct me if I'm wrong.  The best hackish way I've found to 'send data' to 
another portlet immediately is by calling an action directly on that 
portlet via org.apache.turbine.modules.ActionLoader  in your action or 
setting the portlet id (js_peid) and 'action' variales in the template form 
to the other portlet id etc.

Anyone else have better ideas?   A scoped context object/ scoped actions 
would be cool, but I think to implement this with our current portlet 
lifecycle you would have to add an action handling phase for each of the 
scopes to the page rendering or whatever, ie 'handleGlobalActions()' etc, 
with the portlet handling only the portlet scoped actions and the 
GenericMVCContext being passed along to each of the subsequent scope stages 
for additional processing.  This seems like a lot of work to me, but 
probably doable.  Has there been any talk of such?  I imagine there would 
be a 'session', 'portal', 'portlet set' and the current 'portal' context 
scopes, and that the starting context object for each request would be 
cloned from the session object and passed down through the differet scopes, 
ending up as a parameter to getContent().

Then again I could be 'missing the boat' entirely. :)


-tk


At 07:58 PM 3/29/2003 +0200, nick the mytilian wrote:
>Hi,
>
>I am facing the following problem:
>I use the JspPortlet to present the output of a JSP in a portlet.
>I want to "put" a String in the context, so that another portlet
>can get it.
>Unfortunately, i see that the only way to use something like:
>String lala = (String) rundata.getSession().getAttribute("Testing");
>context.put("testing",lala);
>
>is to  implement a portlet with action that extends the
>VelocityPortletAction.
>
>BUT: I do not want to use Velocity! (I have already written the code in
>JSP)
>
>How can i put something in the Context, using the JspPortlet and not the
>VelocityPortlet?
>
>Thanks in advance!
>
>Nikos.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org