You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by Stefan Zoerner <sz...@apache.org> on 2005/12/20 22:37:46 UTC

PortletURL: Parameter missing if used in form submission

Hi all,

I wrote some simple portlets and encountered a problem with parameters 
in Portlet URLs. After some research, I reduced it to this JSP (a render 
method uses a PortletRequestDispatcher to invoke it:

--8<--

<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>

<portlet:actionURL var="myUrl">
   <portlet:param name="paramName" value="paramValue"/>
</portlet:actionURL>

<a href="<%= myUrl %>">Click</a>
<hr>
<form action="<%= myUrl %>">
     <input type="submit">
</form>

-->8--

The behavior I would expect is that both the link and the form 
submission lead to a processAction call where parameter "paramName" has 
a value "paramValue". In Pluto 1.0.1 this is only the case for the link. 
The form submission causes a processAction with no parameter set.

I am not sure whether I am wrong here. Therefore I have tested another 
JSR 168 implementation (WebSphere Portal 5.0.2.2), and it worked (both 
actions contained the parameter). My current workaround is to use a 
hidden field to make it run on Pluto as well.

I assume it is not related to JSP but also possible to create a plain 
Portlet class to demonstrate this issue (if any). Should I raise a JIRA 
defect about this one? And if yes, are you interested in a pure portlet 
class that demonstrates it (I would attach it).

Thanks in advance,
     Stefan


Re: PortletURL: Parameter missing if used in form submission

Posted by Eric Dalquist <ed...@unicon.net>.
Not a problem, the get vs post on form submissions is quite the gotcha 
with the portlet spec (not that the spec could do anything about the 
core problem with get based forms).

-Eric

Stefan Zoerner wrote:

> Eric Dalquist wrote:
>
>> Add method="post" to your form. Per the JSR-168 spec GET based form 
>> submission is not supported for portlets.
>
>
> Eric, thank you for your immediate response and your hint! I added the 
> attribute to the form and it works perfect both for the JSP I 
> submitted in my question and for my "real world" examples. So I am happy.
>
> Greetings, Stefan
>
>
>

Re: PortletURL: Parameter missing if used in form submission

Posted by Stefan Zoerner <sz...@apache.org>.
Eric Dalquist wrote:
> Add method="post" to your form. Per the JSR-168 spec GET based form 
> submission is not supported for portlets.

Eric, thank you for your immediate response and your hint! I added the 
attribute to the form and it works perfect both for the JSP I submitted 
in my question and for my "real world" examples. So I am happy.

Greetings, Stefan



Re: PortletURL: Parameter missing if used in form submission

Posted by Eric Dalquist <ed...@unicon.net>.
Add method="post" to your form. Per the JSR-168 spec GET based form 
submission is not supported for portlets.

-Eric

Stefan Zoerner wrote:

> Hi all,
>
> I wrote some simple portlets and encountered a problem with parameters 
> in Portlet URLs. After some research, I reduced it to this JSP (a 
> render method uses a PortletRequestDispatcher to invoke it:
>
> --8<--
>
> <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
>
> <portlet:actionURL var="myUrl">
>   <portlet:param name="paramName" value="paramValue"/>
> </portlet:actionURL>
>
> <a href="<%= myUrl %>">Click</a>
> <hr>
> <form action="<%= myUrl %>">
>     <input type="submit">
> </form>
>
> -->8--
>
> The behavior I would expect is that both the link and the form 
> submission lead to a processAction call where parameter "paramName" 
> has a value "paramValue". In Pluto 1.0.1 this is only the case for the 
> link. The form submission causes a processAction with no parameter set.
>
> I am not sure whether I am wrong here. Therefore I have tested another 
> JSR 168 implementation (WebSphere Portal 5.0.2.2), and it worked (both 
> actions contained the parameter). My current workaround is to use a 
> hidden field to make it run on Pluto as well.
>
> I assume it is not related to JSP but also possible to create a plain 
> Portlet class to demonstrate this issue (if any). Should I raise a 
> JIRA defect about this one? And if yes, are you interested in a pure 
> portlet class that demonstrates it (I would attach it).
>
> Thanks in advance,
>     Stefan
>
>