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" <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]