[jboss-jira] [JBoss JIRA] Commented: (JBPORTAL-2356) It is impossible to use html forms in portlets or js to build http request

Bernard de Terwangne (JIRA) jira-events at lists.jboss.org
Thu Mar 26 12:45:22 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBPORTAL-2356?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12459246#action_12459246 ] 

Bernard de Terwangne commented on JBPORTAL-2356:
------------------------------------------------

Thomas,

Let's put it another way : 

<form action="<portlet:actionURL/>">
<input name="q" type="text/>
<input type="submit"/>
</form> 

now my trace will allways print "null". You can only get values of parameters declared in portlet:param tags. This means it is impossible to send any value the end user has typed to the java code.

I've been digging into the source code to understand how it work and it seems to be designed to prevent passing parameters from the browser. Liferay for instance only uses common HTTP parameters. When instanciating the PortletRequest from the HttpServletRequest, it removes all portal specific parameters so the your java code sees only the ones it expects.

It is a bug because it is just impossible to use. Note that you can find such construct in some of the samples that come with the product. The samples of course do not work !!!

Bernard

> It is impossible to use html forms in portlets or js to build http request
> --------------------------------------------------------------------------
>
>                 Key: JBPORTAL-2356
>                 URL: https://jira.jboss.org/jira/browse/JBPORTAL-2356
>             Project: JBoss Portal
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Portal Portlet
>    Affects Versions: Portlet-2.0.1
>         Environment: Linux, Java 5, Tomcat, JBoss Portlet Container 2.0
>            Reporter: Bernard de Terwangne
>
> JBoss Portlet container conforms to the spec so well that it becomes unusable. It is impossible to query the end-user for a value and pass that value in processAction or serveResource calls. Let's say you write this in your JSP page :
> <form action="<portlet:actionURL><portlet:param name='q' value='yop'/></portlet:actionURL">
> <input name="q" type="text/>
> <input type="submit"/>
> </form>
> and in the Java code
> 	public void processAction(ActionRequest req, ActionResponse res)
> 			throws IOException, PortletException {
> 		System.out.println(req.getParameter("q");
>         }
> The printed value will allways be "yop" (the value placed in the portlet:param tag. There is no way to retrieve the value actually typed by the end user.
> This is due to the fact JBoss Portlet container mangles in Base64 the parameters from <portlet:param> and disregards parameters appended by the browser's form implementation. Same thing with <resourceURL>. There is no way to pass user input to the portlet's Java code.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list