You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Richard Gal <rg...@gmail.com> on 2009/08/18 15:29:27 UTC

Ajax form submits in a Wicket portlet on Liferay

Hello

I am trying to use Wicket portlets in Liferay (v 5.2.3). The results
are promising, however I have stumbled upon the following problem.
Could someone help me or comment on it, please?

My problem:

I have a form with AjaxButton to submit it. The form consists of
nothing else but a TextField and a Label. When the AjaxButton is
clicked the form is submitted and refreshed and the entered text is
simply echoed in the Label.

The problem occurs when I submit the form more than once. While the
first submit always echoes the entered text correctly, subsequent
submits always echo the text entered the first time. Having debugged
the portlet, I found that the callback URL generated for the buttons
"onclick" handler contains some parameters, which takesthe form of
<portlet_namespace><parameter>.

Specifically the callback url contains also
<raw>
_wexample_WAR_wexampleportlet_requiredBorder:myText=qqq
</raw>
, where <raw>_wexample_WAR_wexampleportlet_</raw> is the portlet
namespace and <raw>requiredBorder:myText</raw> is the TextField in the
form. However, upon submitting the form, the AJAX request also POST's
a <raw>requiredBorder:myText</raw> as post data separately. I noticed
that the parameter in the callback URL always takes the value from the
first submit and it always overrides the POST parameter. (It happens
when Liferay constructs NamespaceServletRequest.)

Has anyone else encountered the same problem? Is there a workaround or
may I be doing something wrong?

The problem only happens when using this portlet in Liferay 5.2.3
(also tried the 5.2.x branch) with its "internal" portlet container.
If I configure Liferay to use the "sun" portlet container then this
issue is not present.

Thanks for any help in advance.

Richie.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax form submits in a Wicket portlet on Liferay

Posted by glr <rg...@gmail.com>.
I renamed the plugin from server-utest-portlet to serverUtest-portlet to
remove any other '-' characters. Still the issue is present.

By the way, is it a Wicket limitation that the Liferay portlet plugin names
should not contain '-' characters other than the one in the '-portlet'
postfix? I am asking this because a lot of Liferay sample portlets have many
'-' characters in their name (e.g. sample-icefaces-ipc-ajax-push-portlet).


Thijs wrote:
> 
> The '-' is a reserved character in the name of a liferay portlet
> a portlets name should end with -portlet and not contain any other '-'
> 

-- 
View this message in context: http://www.nabble.com/Ajax-form-submits-in-a-Wicket-portlet-on-Liferay-tp25024896p25042216.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax form submits in a Wicket portlet on Liferay

Posted by Thijs <vo...@gmail.com>.
The '-' is a reserved character in the name of a liferay portlet
a portlets name should end with -portlet and not contain any other '-'


On 19-8-2009 9:32, glr wrote:
>
> Having investigated the issue further, I noticed that the same code is
> working in some portlets and does not work in others. Therefore I created 2
> portlets with exactly the same content except for the plugin name and the
> portlet-name:
>
> * in the first case the plugin name is wexample-portlet and the portlet-name
> is wexample
>
> * in the other case the plugin name is server-utest-portlet and the
> portlet-name is utest
>
> In both portlets I created 3 test-cases:
>
> 1) echoing the entered text without AJAX.
>
> 2) echoing the entered text with AJAX.
>
> 3) echoing the entered text with AJAX but the relevant page content (e.g.
> form) is moved to a Panel.
>
> Results:
>
> 1) is working in both portlets
>
> 2) is working in wexample-portlet but not in server-utest-portlet
>
> 3) is working in wexample-portlet but not in server-utest-portlet.
>
> I have a feeling that the problem lies in the order NamespaceServletRequest
> resolves request parameters. If the resolving happens in an order that the
> POST'ed input comes first and then the parameter from the buttons callback
> URL then it does not work.
>
> I have attached the 2 portlets. Source code is also included in the WAR's:
> http://www.nabble.com/file/p25039181/wexample-portlet-5.2.2.1.war
> wexample-portlet-5.2.2.1.war
> http://www.nabble.com/file/p25039181/server-utest-portlet-5.2.2.1.war
> server-utest-portlet-5.2.2.1.war


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax form submits in a Wicket portlet on Liferay

Posted by glr <rg...@gmail.com>.
Having investigated the issue further, I noticed that the same code is
working in some portlets and does not work in others. Therefore I created 2
portlets with exactly the same content except for the plugin name and the
portlet-name:

* in the first case the plugin name is wexample-portlet and the portlet-name
is wexample

* in the other case the plugin name is server-utest-portlet and the
portlet-name is utest

In both portlets I created 3 test-cases:

1) echoing the entered text without AJAX.

2) echoing the entered text with AJAX.

3) echoing the entered text with AJAX but the relevant page content (e.g.
form) is moved to a Panel.

Results:

1) is working in both portlets

2) is working in wexample-portlet but not in server-utest-portlet

3) is working in wexample-portlet but not in server-utest-portlet.

I have a feeling that the problem lies in the order NamespaceServletRequest
resolves request parameters. If the resolving happens in an order that the
POST'ed input comes first and then the parameter from the buttons callback
URL then it does not work.

I have attached the 2 portlets. Source code is also included in the WAR's:
http://www.nabble.com/file/p25039181/wexample-portlet-5.2.2.1.war
wexample-portlet-5.2.2.1.war 
http://www.nabble.com/file/p25039181/server-utest-portlet-5.2.2.1.war
server-utest-portlet-5.2.2.1.war 
-- 
View this message in context: http://www.nabble.com/Ajax-form-submits-in-a-Wicket-portlet-on-Liferay-tp25024896p25039181.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org