You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Andy Benjamin <an...@hotmail.com> on 2003/05/26 23:02:23 UTC

Best Practices in Design

Hi everyone,

I have a question that deals with best practices and design.  I have an 
action class that does the work to get the customized information out of a 
portlet.  My question then is how should I get that information into the 
jsp?  Should I take that information and place it in the session so that the 
jsp then looks for a particular attribute in the session?  If I do that then 
conceivably I couldn't have two portlets of the same type on the same page 
because they would be using the same session variables to pass information 
to the jsp.

To illustrate, let's say that I have a portlet that gets my sports links and 
displays them.  I want to reuse the same portlet to have a list of my 
financial links.  Is there anyway to get the action class to communicate 
with the jsp so that two portlets and their action classes don't overwrite 
the other portlet's data when they try and communicate with the jsp?  Thanks 
in advance.

Andy

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.  
http://join.msn.com/?page=features/featuredemail


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


Re: Best Practices in Design

Posted by Michael Rothrock <mi...@michaelrothrock.com>.
For action-to-jsp, I use the following code:

In the action class:

public class foo extends JspPortletAction {
    public static final String RET_SPECIAL_PREFIX = "foo-special-";
    public void doCoolness(RunData rundata, Portlet portlet) {
        String jspeid = portlet.getID();

        rundata.getRequest().setAttribute(
            RET_SPECIAL_PREFIX + jspeid, "Much Coolness");
    }


In the jsp:
<%
String jspeid = (String) request.getAttribute("js_peid");
String coolName = foo.RET_SPECIAL_PREFIX + jspeid;
%>
<%= request.getAttribute(coolName) %>

-- Michael

On 5/27/03 2:51 PM, "Christophe Lombart" <ch...@skynet.be>
wrote:

> I never tested but maybe you can try the following :
> 
> From the action class to the jsp, use the context. it should be
> different for each portlet action.
> 
> From the jsp to the portlet action, try to add the portlet id into the
> http request generated by your jsp page.
> In the action class, check if the http request parameter which match to
> this portlet id is equals to portlet.getId().
> 
> I'm not sure there is another way.
> 
> HTH
> Christophe
> 
> Andy Benjamin wrote:
> 
>> Hi everyone,
>> 
>> I have a question that deals with best practices and design.  I have
>> an action class that does the work to get the customized information
>> out of a portlet.  My question then is how should I get that
>> information into the jsp?  Should I take that information and place it
>> in the session so that the jsp then looks for a particular attribute
>> in the session?  If I do that then conceivably I couldn't have two
>> portlets of the same type on the same page because they would be using
>> the same session variables to pass information to the jsp.
>> 
>> To illustrate, let's say that I have a portlet that gets my sports
>> links and displays them.  I want to reuse the same portlet to have a
>> list of my financial links.  Is there anyway to get the action class
>> to communicate with the jsp so that two portlets and their action
>> classes don't overwrite the other portlet's data when they try and
>> communicate with the jsp?  Thanks in advance.
>> 
>> Andy
>> 
>> _________________________________________________________________
>> Add photos to your messages with MSN 8. Get 2 months FREE*.
>> http://join.msn.com/?page=features/featuredemail
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
>> 
>> 
>> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
> 
> 


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


Re: Best Practices in Design

Posted by Christophe Lombart <ch...@skynet.be>.
I never tested but maybe you can try the following :

 From the action class to the jsp, use the context. it should be 
different for each portlet action.

 From the jsp to the portlet action, try to add the portlet id into the 
http request generated by your jsp page.
In the action class, check if the http request parameter which match to 
this portlet id is equals to portlet.getId().

I'm not sure there is another way.

HTH
Christophe

Andy Benjamin wrote:

> Hi everyone,
>
> I have a question that deals with best practices and design.  I have 
> an action class that does the work to get the customized information 
> out of a portlet.  My question then is how should I get that 
> information into the jsp?  Should I take that information and place it 
> in the session so that the jsp then looks for a particular attribute 
> in the session?  If I do that then conceivably I couldn't have two 
> portlets of the same type on the same page because they would be using 
> the same session variables to pass information to the jsp.
>
> To illustrate, let's say that I have a portlet that gets my sports 
> links and displays them.  I want to reuse the same portlet to have a 
> list of my financial links.  Is there anyway to get the action class 
> to communicate with the jsp so that two portlets and their action 
> classes don't overwrite the other portlet's data when they try and 
> communicate with the jsp?  Thanks in advance.
>
> Andy
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.  
> http://join.msn.com/?page=features/featuredemail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
>
>
>



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


RE: Best Practices in Design

Posted by Mark Orciuch <ma...@ngsltd.com>.
There are several examples of doing what you describe. Take a look at the
JSP Stock Quote portlet.

Best regards,

Mark Orciuch - morciuch@apache.org
Jakarta Jetspeed - Enterprise Portal in Java
http://jakarta.apache.org/jetspeed/

> -----Original Message-----
> From: Andy Benjamin [mailto:andrewnbenjamin@hotmail.com]
> Sent: Monday, May 26, 2003 4:02 PM
> To: jetspeed-user@jakarta.apache.org
> Subject: Best Practices in Design
>
>
> Hi everyone,
>
> I have a question that deals with best practices and design.  I have an
> action class that does the work to get the customized information
> out of a
> portlet.  My question then is how should I get that information into the
> jsp?  Should I take that information and place it in the session
> so that the
> jsp then looks for a particular attribute in the session?  If I
> do that then
> conceivably I couldn't have two portlets of the same type on the
> same page
> because they would be using the same session variables to pass
> information
> to the jsp.
>
> To illustrate, let's say that I have a portlet that gets my
> sports links and
> displays them.  I want to reuse the same portlet to have a list of my
> financial links.  Is there anyway to get the action class to communicate
> with the jsp so that two portlets and their action classes don't
> overwrite
> the other portlet's data when they try and communicate with the
> jsp?  Thanks
> in advance.
>
> Andy
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
>
>
>
>



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