Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Pedro Almeida
Clearing actionRequest parameters
2 de Outubro de 2012 09:37
Resposta

Pedro Almeida

Ranking: Junior Member

Mensagens: 41

Data de entrada: 30 de Julho de 2012

Mensagens recentes

Hello,

I am developing a portlet where I have process action methods that read parameters from the ActionRequest parameter.

I can read them properly, but if I refresh a page, the process action method is fired again, with the parameter still containing the previous value, even though it was not introduced again. I don't want this to be persistent, I only want it to last for that specific form submission.

Is there a direct way (programatically clearing) or indirect (configuration setup) to change this behaviour?

Thank you.
David H Nebinger
RE: Clearing actionRequest parameters
2 de Outubro de 2012 10:02
Resposta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensagens: 8554

Data de entrada: 1 de Setembro de 2006

Mensagens recentes

I don't think this is possible.

The action params are part of the page sitting on the browser, so you don't have any real access to them to clear them out.
Sampsa Sohlman
RE: Clearing actionRequest parameters
2 de Outubro de 2012 10:32
Resposta

Sampsa Sohlman

LIFERAY STAFF

Ranking: Regular Member

Mensagens: 219

Data de entrada: 27 de Setembro de 2007

Mensagens recentes

Pedro Almeida:
Is there a direct way (programatically clearing) or indirect (configuration setup) to change this behaviour?


As David did mention this happens on client side, and this is typical doublesubmit problem. You can do following to solve it.

When you render the page you can put there hidden field containing time value in milliseconds and save same time value in milliseconds to your portlet session. Before you read the values from action request, read this hidden field value containing millis and compare that to your value to value from portlet session. If the values are match read the rest and do the business logic, if the values are not match ignore action request values and you can show also warning or error message.
Pedro Almeida
RE: Clearing actionRequest parameters
3 de Outubro de 2012 03:25
Resposta

Pedro Almeida

Ranking: Junior Member

Mensagens: 41

Data de entrada: 30 de Julho de 2012

Mensagens recentes

found a solution here

http://www.liferay.com/community/forums/-/message_boards/message/16700678

it works! thanks!
Sampsa Sohlman
RE: Clearing actionRequest parameters
4 de Outubro de 2012 03:46
Resposta

Sampsa Sohlman

LIFERAY STAFF

Ranking: Regular Member

Mensagens: 219

Data de entrada: 27 de Setembro de 2007

Mensagens recentes

1You can configure this in liferay-portlet.xml file.
2
3check action-url-redirect attribue


Actually, that does not protect on all cases. The case that your user is pressing button twice very fast and network is little bit slow. So if you are billing customer when he is clicking the button and you want to avoid double billing all cases use solution that I did describe above.
Pedro Almeida
RE: Clearing actionRequest parameters
4 de Outubro de 2012 08:56
Resposta

Pedro Almeida

Ranking: Junior Member

Mensagens: 41

Data de entrada: 30 de Julho de 2012

Mensagens recentes

Sampsa Sohlman:
1You can configure this in liferay-portlet.xml file.
2
3check action-url-redirect attribue


Actually, that does not protect on all cases. The case that your user is pressing button twice very fast and network is little bit slow. So if you are billing customer when he is clicking the button and you want to avoid double billing all cases use solution that I did describe above.


good point! thanks!