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 Christine <ch...@christine.nl> on 2009/09/25 16:01:00 UTC
links and parameters
This may be a jsp question more than a jetspeed question.
Suppose I create a link, like so:
Name: <a href="?name=<%=p.getFirstName() %>"><%=p.getFirstName() %>
where p is an instance of a class that retrieves data from a database.
How do I retrieve the value of "name" in my java code? Or else, what is
the best way to pass parameters with links?
dagdag
Christine
--
dagdag is just a two-character rotation of byebye.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: links and parameters
Posted by Ate Douma <at...@douma.nu>.
Christine wrote:
> Ate Douma wrote:
>> Christine, in your case you might not be concerned with WSRP (yet), in
>> which case you may use the non JSR-168/286 compliant Jetspeed portal
>> settings to merge plain url parameters. But even then, the reasons
>> provided above by s2o still should be taken into account.
> Thanks for the replies. All I want to do is display a list of names that
> are clickable and pass a parameter that identifies the person. Is there
> another way of doing that except passing a parameter in the url? I don't
> want to use a POST because I don't want a lot of buttons on the page.
Within you jsp, you can use something like the following:
<%@ taglib uri=”http://java.sun.com/portlet_2_0” prefix=”portlet”%>
<portlet:defineObjects/>
Name: <a href="<portlet:renderURL><portlet:param name='name' value='{$p.firstName}'/></portlet:renderURL>">${p.firstName}</a>
Regards,
Ate
>
> Christine
>>
>> Regards,
>>
>> Ate
>>>
>>> Anyway, there are some workarounds to do it :=)
>>>
>>> s2o
>>> http://s2o-bcn.blogspot.com/
>>>
>>>
>>> 2009/9/28 Christine <ch...@christine.nl>
>>>
>>>> Christine wrote:
>>>>
>>>>> This may be a jsp question more than a jetspeed question.
>>>>> Suppose I create a link, like so:
>>>>> Name: <a href="?name=<%=p.getFirstName() %>"><%=p.getFirstName() %>
>>>>>
>>>> Right.
>>>> I found this (JS2-605):
>>>> "Query string parameters should not (by default) be provided to
>>>> portlets to
>>>> be compliant to JSR 168 spec requirements"
>>>>
>>>> and this:
>>>> <js:metadata
>>>> name="merge.portal.parameters.with.portlet.parameters">true</js:metadata>
>>>>
>>>> <js:metadata
>>>> name="merge.portal.parameters.before.portlet.parameters">true</js:metadata>
>>>>
>>>>
>>>> My first question is, why should url parameters not be passed to a
>>>> portlet,
>>>> as the spec requires? I can imagine url parameters that override
>>>> portlet
>>>> parameters can be a risk, but otherwise, what's the rationale behind
>>>> not
>>>> passing them?
>>>> Second, I suggest to make this issue more clear in the documentation
>>>> or in
>>>> the tutorial or in the faq.
>>>>
>>>> :-)
>>>>
>>>>
>>>> dagdag
>>>> Christine
>>>>
>>>>
>>>>
>>>> --
>>>> dagdag is just a two-character rotation of byebye.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
>>>> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>>>>
>>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
>> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: links and parameters
Posted by Christine <ch...@christine.nl>.
Ate Douma wrote:
> Christine, in your case you might not be concerned with WSRP (yet), in
> which case you may use the non JSR-168/286 compliant Jetspeed portal
> settings to merge plain url parameters. But even then, the reasons
> provided above by s2o still should be taken into account.
Thanks for the replies. All I want to do is display a list of names that
are clickable and pass a parameter that identifies the person. Is there
another way of doing that except passing a parameter in the url? I don't
want to use a POST because I don't want a lot of buttons on the page.
Christine
>
> Regards,
>
> Ate
>>
>> Anyway, there are some workarounds to do it :=)
>>
>> s2o
>> http://s2o-bcn.blogspot.com/
>>
>>
>> 2009/9/28 Christine <ch...@christine.nl>
>>
>>> Christine wrote:
>>>
>>>> This may be a jsp question more than a jetspeed question.
>>>> Suppose I create a link, like so:
>>>> Name: <a href="?name=<%=p.getFirstName() %>"><%=p.getFirstName() %>
>>>>
>>> Right.
>>> I found this (JS2-605):
>>> "Query string parameters should not (by default) be provided to
>>> portlets to
>>> be compliant to JSR 168 spec requirements"
>>>
>>> and this:
>>> <js:metadata
>>> name="merge.portal.parameters.with.portlet.parameters">true</js:metadata>
>>>
>>> <js:metadata
>>> name="merge.portal.parameters.before.portlet.parameters">true</js:metadata>
>>>
>>>
>>> My first question is, why should url parameters not be passed to a
>>> portlet,
>>> as the spec requires? I can imagine url parameters that override
>>> portlet
>>> parameters can be a risk, but otherwise, what's the rationale behind
>>> not
>>> passing them?
>>> Second, I suggest to make this issue more clear in the documentation
>>> or in
>>> the tutorial or in the faq.
>>>
>>> :-)
>>>
>>>
>>> dagdag
>>> Christine
>>>
>>>
>>>
>>> --
>>> dagdag is just a two-character rotation of byebye.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
>>> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>>>
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
--
dagdag is just a two-character rotation of byebye.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: links and parameters
Posted by Ate Douma <at...@douma.nu>.
blog s2o.bcn wrote:
> Hi Christine,
>
> I'm not an expert as a portlet developer, but what I supposed when I saw
> this restriction is that a portlet is just a piece of a page, so you can
> have the same porlet (with different namespace!) two times in the same page.
> With the last spec (jsr-286) you can pass parameters in more natural way.
>
> In my experience, when you are programing with portlets you have to be
> always aware that:
> - you can have the portlet more than one time on a page, so be careful with
> you javascript variables. Use namespace.
> - one portlet page is the composition of one or more portlets, so be careful
> with the state of every "piece" of the page when you leave that page.
Besides the above reasons, which are very valid, there is another one: WSRP usage.
If you produce a remote portlet with WSRP, its content will not be rendered without your local context but by the remote portlet consumer.
This is *the* reason why the portlet spec doesn't allow (support) access to the (browser) URL, nor writing/modify it by yourself.
For a remote portlet, the URL is an unknown construct so it can only provide read/write parameters to the PortletURL object itself.
Christine, in your case you might not be concerned with WSRP (yet), in which case you may use the non JSR-168/286 compliant Jetspeed portal
settings to merge plain url parameters. But even then, the reasons provided above by s2o still should be taken into account.
Regards,
Ate
>
> Anyway, there are some workarounds to do it :=)
>
> s2o
> http://s2o-bcn.blogspot.com/
>
>
> 2009/9/28 Christine <ch...@christine.nl>
>
>> Christine wrote:
>>
>>> This may be a jsp question more than a jetspeed question.
>>> Suppose I create a link, like so:
>>> Name: <a href="?name=<%=p.getFirstName() %>"><%=p.getFirstName() %>
>>>
>> Right.
>> I found this (JS2-605):
>> "Query string parameters should not (by default) be provided to portlets to
>> be compliant to JSR 168 spec requirements"
>>
>> and this:
>> <js:metadata
>> name="merge.portal.parameters.with.portlet.parameters">true</js:metadata>
>> <js:metadata
>> name="merge.portal.parameters.before.portlet.parameters">true</js:metadata>
>>
>> My first question is, why should url parameters not be passed to a portlet,
>> as the spec requires? I can imagine url parameters that override portlet
>> parameters can be a risk, but otherwise, what's the rationale behind not
>> passing them?
>> Second, I suggest to make this issue more clear in the documentation or in
>> the tutorial or in the faq.
>>
>> :-)
>>
>>
>> dagdag
>> Christine
>>
>>
>>
>> --
>> dagdag is just a two-character rotation of byebye.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
>> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
Re: links and parameters
Posted by "blog s2o.bcn" <bl...@sacristan.com.es>.
Hi Christine,
I'm not an expert as a portlet developer, but what I supposed when I saw
this restriction is that a portlet is just a piece of a page, so you can
have the same porlet (with different namespace!) two times in the same page.
With the last spec (jsr-286) you can pass parameters in more natural way.
In my experience, when you are programing with portlets you have to be
always aware that:
- you can have the portlet more than one time on a page, so be careful with
you javascript variables. Use namespace.
- one portlet page is the composition of one or more portlets, so be careful
with the state of every "piece" of the page when you leave that page.
Anyway, there are some workarounds to do it :=)
s2o
http://s2o-bcn.blogspot.com/
2009/9/28 Christine <ch...@christine.nl>
> Christine wrote:
>
>> This may be a jsp question more than a jetspeed question.
>> Suppose I create a link, like so:
>> Name: <a href="?name=<%=p.getFirstName() %>"><%=p.getFirstName() %>
>>
> Right.
> I found this (JS2-605):
> "Query string parameters should not (by default) be provided to portlets to
> be compliant to JSR 168 spec requirements"
>
> and this:
> <js:metadata
> name="merge.portal.parameters.with.portlet.parameters">true</js:metadata>
> <js:metadata
> name="merge.portal.parameters.before.portlet.parameters">true</js:metadata>
>
> My first question is, why should url parameters not be passed to a portlet,
> as the spec requires? I can imagine url parameters that override portlet
> parameters can be a risk, but otherwise, what's the rationale behind not
> passing them?
> Second, I suggest to make this issue more clear in the documentation or in
> the tutorial or in the faq.
>
> :-)
>
>
> dagdag
> Christine
>
>
>
> --
> dagdag is just a two-character rotation of byebye.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-user-help@portals.apache.org
>
>
Re: links and parameters
Posted by Christine <ch...@christine.nl>.
Christine wrote:
> This may be a jsp question more than a jetspeed question.
> Suppose I create a link, like so:
> Name: <a href="?name=<%=p.getFirstName() %>"><%=p.getFirstName() %>
Right.
I found this (JS2-605):
"Query string parameters should not (by default) be provided to portlets
to be compliant to JSR 168 spec requirements"
and this:
<js:metadata
name="merge.portal.parameters.with.portlet.parameters">true</js:metadata>
<js:metadata
name="merge.portal.parameters.before.portlet.parameters">true</js:metadata>
My first question is, why should url parameters not be passed to a
portlet, as the spec requires? I can imagine url parameters that
override portlet parameters can be a risk, but otherwise, what's the
rationale behind not passing them?
Second, I suggest to make this issue more clear in the documentation or
in the tutorial or in the faq.
:-)
dagdag
Christine
--
dagdag is just a two-character rotation of byebye.
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org