You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Jason Novotny <no...@aei.mpg.de> on 2004/01/19 07:00:33 UTC

how to use setRenderParameter

    Hi,

    I'm trying to figure out how the setRenderParameter method is 
supposed to work. Maybe someone can show me a sample example of how I 
can use it. My guess is that if I use response.setRenderParameter("foo", 
"bar");  in my processAction method and then call 
response.createRenderURL()  (what if I call createActionURL() instead? ) 
then the URL should include the encoded render parameters e.g.  
"&foo=bar". Is this even remotely close? ;-)

    Thanks, Jason


Re: how to use setRenderParameter

Posted by Stefan Hepper <st...@hursley.ibm.com>.
Hi Jason,
properties are a means to communicate settings from portal / portlet 
container to portlet and portlet to portal / portlet container. As the 
sample portal does not have any extensions that it supports, nothing is 
done in the sample portal.
Whereas the render parameters are state that defines the current view of 
the portlet.

Stefan


Jason Novotny wrote:

> 
> Hi Stefan,
> 
>    I've been looking at the specs. and now I'm also wondering what is 
> the difference (in implementation and handling) between the 
> response.setProperty methods and actionresponse.setRenderParameters-- 
> from what I can tell the container doesn't do anything at all with the 
> response properties, however for render parameters it does...
> 
>    Thanks, Jason
> 
> Stefan Hepper wrote:
> 
>> No, render parameters are a new concept that separates portlets from 
>> servlets. Portlets get the render params for all subsequent request 
>> until the next action occurs or the page is left (than its left to the 
>> portal implemention to keep the params accross pages). Otherwise the 
>> back button and bookmarkability will not work.
>>
>> Please see also the corresponding sections in the Portlet Specification.
>>
>> Stefan
>>
>>
>> Jason Novotny wrote:
>>
>>>
>>>    Ok, so far the best portlet examples I've found are the Sun sample 
>>> portlets and I think I have an example, but I'm still not entirely 
>>> sure what is going on. I see in the NotepadPortlet, the processAction 
>>> method has a line like this:
>>>
>>>    actionResponse.setRenderParameter( CATEGORY, category );
>>>
>>>    Then in a JSP page that is invoked in the view mode, I see the 
>>> following line:
>>>
>>>    String category = pReq.getParameter( NotepadPortlet.CATEGORY );
>>>
>>>   It looks like by setting a render parameter in the response, one 
>>> can use that to do something in the presentation method-- I thought 
>>> getParameter was only used for values that appear as names in forms 
>>> or as paramters in hyperlinks. So does this mean the getParameter of 
>>> the PortletRequest object first obtains render paramters from the 
>>> action response object before returning servletRequest.getParameter()?
>>>
>>>    Thanks, Jason
>>>
>>>
>>> Stefan Hepper wrote:
>>>
>>>> No, the setRenderParameter sets the render parameters for the 
>>>> following render calls after action is finished. As the render 
>>>> parameters are resetted when calling an action this is the only way 
>>>> to set new render parameters after finishing the action.
>>>> Created URLs only contain those parameters that you explicitly set 
>>>> on the URL.
>>>>
>>>> Stefan
>>>>
>>>> Jason Novotny wrote:
>>>>
>>>>>
>>>>>    Hi,
>>>>>
>>>>>    I'm trying to figure out how the setRenderParameter method is 
>>>>> supposed to work. Maybe someone can show me a sample example of how 
>>>>> I can use it. My guess is that if I use 
>>>>> response.setRenderParameter("foo", "bar");  in my processAction 
>>>>> method and then call response.createRenderURL()  (what if I call 
>>>>> createActionURL() instead? ) then the URL should include the 
>>>>> encoded render parameters e.g.  "&foo=bar". Is this even remotely 
>>>>> close? ;-)
>>>>>
>>>>>    Thanks, Jason
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
> 
> 
> 


Re: how to use setRenderParameter

Posted by Jason Novotny <no...@aei.mpg.de>.
Hi Stefan,

    I've been looking at the specs. and now I'm also wondering what is 
the difference (in implementation and handling) between the 
response.setProperty methods and actionresponse.setRenderParameters-- 
from what I can tell the container doesn't do anything at all with the 
response properties, however for render parameters it does...

    Thanks, Jason

Stefan Hepper wrote:

> No, render parameters are a new concept that separates portlets from 
> servlets. Portlets get the render params for all subsequent request 
> until the next action occurs or the page is left (than its left to the 
> portal implemention to keep the params accross pages). Otherwise the 
> back button and bookmarkability will not work.
>
> Please see also the corresponding sections in the Portlet Specification.
>
> Stefan
>
>
> Jason Novotny wrote:
>
>>
>>    Ok, so far the best portlet examples I've found are the Sun sample 
>> portlets and I think I have an example, but I'm still not entirely 
>> sure what is going on. I see in the NotepadPortlet, the processAction 
>> method has a line like this:
>>
>>    actionResponse.setRenderParameter( CATEGORY, category );
>>
>>    Then in a JSP page that is invoked in the view mode, I see the 
>> following line:
>>
>>    String category = pReq.getParameter( NotepadPortlet.CATEGORY );
>>
>>   It looks like by setting a render parameter in the response, one 
>> can use that to do something in the presentation method-- I thought 
>> getParameter was only used for values that appear as names in forms 
>> or as paramters in hyperlinks. So does this mean the getParameter of 
>> the PortletRequest object first obtains render paramters from the 
>> action response object before returning servletRequest.getParameter()?
>>
>>    Thanks, Jason
>>
>>
>> Stefan Hepper wrote:
>>
>>> No, the setRenderParameter sets the render parameters for the 
>>> following render calls after action is finished. As the render 
>>> parameters are resetted when calling an action this is the only way 
>>> to set new render parameters after finishing the action.
>>> Created URLs only contain those parameters that you explicitly set 
>>> on the URL.
>>>
>>> Stefan
>>>
>>> Jason Novotny wrote:
>>>
>>>>
>>>>    Hi,
>>>>
>>>>    I'm trying to figure out how the setRenderParameter method is 
>>>> supposed to work. Maybe someone can show me a sample example of how 
>>>> I can use it. My guess is that if I use 
>>>> response.setRenderParameter("foo", "bar");  in my processAction 
>>>> method and then call response.createRenderURL()  (what if I call 
>>>> createActionURL() instead? ) then the URL should include the 
>>>> encoded render parameters e.g.  "&foo=bar". Is this even remotely 
>>>> close? ;-)
>>>>
>>>>    Thanks, Jason
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>



Re: how to use setRenderParameter

Posted by Stefan Hepper <st...@hursley.ibm.com>.
Actually the current spec says:

"If a portlet receives a render request that is the result of a client 
request targeted to
another portlet in the portal page, the parameters must be the same 
parameters as of the
previous render request." (p.43)

which should be:
"If a portlet receives a render request that is the result of a client 
request targeted to
another portlet in the portal page, the parameters SHOULD be the same 
parameters as of the
previous render request of this client."

We'll add this as clearification.

This means that you should provide the portlet with its render params, 
but the portlet must always take into account that for some reasons it 
will not get the render params in the next request. Which is fine if the 
render params are used to encode navigational state and not session 
state. Bookmarkability and the enablement of the back button is only a 
side effect of this, but not a requirement by the spec. So storing them 
in the session and not providing support for the back button is also a 
vaild implementation.

Stefan




Endre Stølsvik wrote:

> On Wed, 21 Jan 2004, Stefan Hepper wrote:
> 
> | No, render parameters are a new concept that separates portlets from 
> | servlets. Portlets get the render params for all subsequent request 
> | until the next action occurs or the page is left (than its left to the 
> | portal implemention to keep the params accross pages). Otherwise the 
> | back button and bookmarkability will not work.
> 
> Does the spec require the back button and bookmarkability to work? I was
> assuming that as long as the portlet got the render parameters every time
> (on every rendering), it was fine.
>   See, I thought about keeping the render parameters for each portlet in
> some session object for the current user - and then just supply them to
> the portlet on each rendering - of course adhering to the contract of
> clearing them on action, and setting "new ones" on RenderURL.
> 
> | 
> | Please see also the corresponding sections in the Portlet Specification.
> 
> Where..?
> 
> Endre.
> 
> 


Re: how to use setRenderParameter

Posted by Endre Stølsvik <En...@Stolsvik.com>.
On Wed, 21 Jan 2004, Stefan Hepper wrote:

| No, render parameters are a new concept that separates portlets from 
| servlets. Portlets get the render params for all subsequent request 
| until the next action occurs or the page is left (than its left to the 
| portal implemention to keep the params accross pages). Otherwise the 
| back button and bookmarkability will not work.

Does the spec require the back button and bookmarkability to work? I was
assuming that as long as the portlet got the render parameters every time
(on every rendering), it was fine.
  See, I thought about keeping the render parameters for each portlet in
some session object for the current user - and then just supply them to
the portlet on each rendering - of course adhering to the contract of
clearing them on action, and setting "new ones" on RenderURL.

| 
| Please see also the corresponding sections in the Portlet Specification.

Where..?

Endre.


Re: how to use setRenderParameter

Posted by Stefan Hepper <st...@hursley.ibm.com>.
No, render parameters are a new concept that separates portlets from 
servlets. Portlets get the render params for all subsequent request 
until the next action occurs or the page is left (than its left to the 
portal implemention to keep the params accross pages). Otherwise the 
back button and bookmarkability will not work.

Please see also the corresponding sections in the Portlet Specification.

Stefan


Jason Novotny wrote:
> 
>    Ok, so far the best portlet examples I've found are the Sun sample 
> portlets and I think I have an example, but I'm still not entirely sure 
> what is going on. I see in the NotepadPortlet, the processAction method 
> has a line like this:
> 
>    actionResponse.setRenderParameter( CATEGORY, category );
> 
>    Then in a JSP page that is invoked in the view mode, I see the 
> following line:
> 
>    String category = pReq.getParameter( NotepadPortlet.CATEGORY );
> 
>   It looks like by setting a render parameter in the response, one can 
> use that to do something in the presentation method-- I thought 
> getParameter was only used for values that appear as names in forms or 
> as paramters in hyperlinks. So does this mean the getParameter of the 
> PortletRequest object first obtains render paramters from the action 
> response object before returning servletRequest.getParameter()?
> 
>    Thanks, Jason
> 
> 
> Stefan Hepper wrote:
> 
>> No, the setRenderParameter sets the render parameters for the 
>> following render calls after action is finished. As the render 
>> parameters are resetted when calling an action this is the only way to 
>> set new render parameters after finishing the action.
>> Created URLs only contain those parameters that you explicitly set on 
>> the URL.
>>
>> Stefan
>>
>> Jason Novotny wrote:
>>
>>>
>>>    Hi,
>>>
>>>    I'm trying to figure out how the setRenderParameter method is 
>>> supposed to work. Maybe someone can show me a sample example of how I 
>>> can use it. My guess is that if I use 
>>> response.setRenderParameter("foo", "bar");  in my processAction 
>>> method and then call response.createRenderURL()  (what if I call 
>>> createActionURL() instead? ) then the URL should include the encoded 
>>> render parameters e.g.  "&foo=bar". Is this even remotely close? ;-)
>>>
>>>    Thanks, Jason
>>>
>>>
>>
>>
> 
> 
> 


Re: how to use setRenderParameter

Posted by Jason Novotny <no...@aei.mpg.de>.
    Ok, so far the best portlet examples I've found are the Sun sample 
portlets and I think I have an example, but I'm still not entirely sure 
what is going on. I see in the NotepadPortlet, the processAction method 
has a line like this:

    actionResponse.setRenderParameter( CATEGORY, category );

    Then in a JSP page that is invoked in the view mode, I see the 
following line:

    String category = pReq.getParameter( NotepadPortlet.CATEGORY );

   It looks like by setting a render parameter in the response, one can 
use that to do something in the presentation method-- I thought 
getParameter was only used for values that appear as names in forms or 
as paramters in hyperlinks. So does this mean the getParameter of the 
PortletRequest object first obtains render paramters from the action 
response object before returning servletRequest.getParameter()?

    Thanks, Jason


Stefan Hepper wrote:

> No, the setRenderParameter sets the render parameters for the 
> following render calls after action is finished. As the render 
> parameters are resetted when calling an action this is the only way to 
> set new render parameters after finishing the action.
> Created URLs only contain those parameters that you explicitly set on 
> the URL.
>
> Stefan
>
> Jason Novotny wrote:
>
>>
>>    Hi,
>>
>>    I'm trying to figure out how the setRenderParameter method is 
>> supposed to work. Maybe someone can show me a sample example of how I 
>> can use it. My guess is that if I use 
>> response.setRenderParameter("foo", "bar");  in my processAction 
>> method and then call response.createRenderURL()  (what if I call 
>> createActionURL() instead? ) then the URL should include the encoded 
>> render parameters e.g.  "&foo=bar". Is this even remotely close? ;-)
>>
>>    Thanks, Jason
>>
>>
>
>



Re: how to use setRenderParameter

Posted by Stefan Hepper <st...@hursley.ibm.com>.
No, the setRenderParameter sets the render parameters for the following 
render calls after action is finished. As the render parameters are 
resetted when calling an action this is the only way to set new render 
parameters after finishing the action.
Created URLs only contain those parameters that you explicitly set on 
the URL.

Stefan

Jason Novotny wrote:

> 
>    Hi,
> 
>    I'm trying to figure out how the setRenderParameter method is 
> supposed to work. Maybe someone can show me a sample example of how I 
> can use it. My guess is that if I use response.setRenderParameter("foo", 
> "bar");  in my processAction method and then call 
> response.createRenderURL()  (what if I call createActionURL() instead? ) 
> then the URL should include the encoded render parameters e.g.  
> "&foo=bar". Is this even remotely close? ;-)
> 
>    Thanks, Jason
> 
>