Foren

Prevent SessionMessages "Your request processed successfully."

thumbnail
Corné Aussems, geändert vor 13 Jahren.

Prevent SessionMessages "Your request processed successfully."

Liferay Legend Beiträge: 1313 Beitrittsdatum: 03.10.06 Neueste Beiträge
I like to keep my jsp free from code (as much as possible considering liferays ui taglibs)

So far so good no problems here; emoticon

I have a ADD button declared with a actionUrl;
<a href="<portlet:actionURL name=" addNew"></a>"&gt;<liferay-ui:message key="add" />
<br><br>Using annotations i do my thing in the portlets addNew method; no hrams here<br><br>But every time i hit the(any) action url i get the message "Your request processed successfully." displayed <br><br>When i look into the SessionMessages object in the addNew methode thers no message at all;<br>SessionMessages.clear() doesn't help either;<br><br>Why is this message always set en how should i prevent it from displaying ?<br><br><br>BTW im using <br>LR 605<br>com.liferay.util.bridges.mvc.MVCPortlet
thumbnail
Nagendra Kumar Busam, geändert vor 13 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Master Beiträge: 678 Beitrittsdatum: 07.07.09 Neueste Beiträge
Hi Corne,

Did you tried clearing SessionMessages in render method?

I hope portlet_messages.jspf is the file which used to display these messages

Regards,
- Nagendra KUmar
thumbnail
Amos Fong, geändert vor 13 Jahren.

RE: Prevent SessionMessages "Your request processed successfully." (Antwort)

Liferay Legend Beiträge: 2047 Beitrittsdatum: 07.10.08 Neueste Beiträge
Hi,

There's a couple options. To always not show it you add this in portlet.xml

		<init-param>
			<name>add-process-action-success-action</name>
			<value>false</value>
		</init-param>


or if you want to change to logic say for just one action you can override the method:

	protected void addSuccessMessage(
		ActionRequest actionRequest, ActionResponse actionResponse) {

		if (!addProcessActionSuccessMessage) {
			return;
		}

		String successMessage = ParamUtil.getString(
			actionRequest, "successMessage");

		SessionMessages.add(actionRequest, "request_processed", successMessage);
	}
thumbnail
Corné Aussems, geändert vor 13 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend Beiträge: 1313 Beitrittsdatum: 03.10.06 Neueste Beiträge
Thanks for sharing Amos
thumbnail
Sandeep Nair, geändert vor 13 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Hi Amos,

Thanks for the solution. One query i had is, i normally use annotation based process action, so what should i do to hide the messages from certain annotation based processAction.

I didnot quite actually understand the second method of overriding the method.

Regards,
Sandeep
thumbnail
Nilesh Gundecha, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
Hi Corne and Sandip,

As per the 2 options given by Corne, I tried the first one but thats not reflecting.

I am doing it Liferay Login Portlet.

Can you please point out where I must be getting wrong.

Regards,

Nilesh
thumbnail
Sandeep Nair, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Which version of liferay are you using. It will work if you are using GenericPortlet.
thumbnail
Nilesh Gundecha, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
Thanks for the reply Sandip.

I am using Liferay 6.0.6 CE. And I want to disable the SessionMessage "Your request processed successfully." for the Liferay Login portlet.

So I tried the first option given by Corne by modifying the portlet-custom.xml, but that didnt help.

Can you please tell me how can I override addSuccessMessage() method for login portlet.

Thanks and Regards,

Nilesh
thumbnail
Sandeep Nair, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend Beiträge: 1744 Beitrittsdatum: 06.11.08 Neueste Beiträge
Hi Neelesh,

It should work. Please debug the source code. Check for LiferayPortlet class which StrutsPortlet uses, there is an init method in which the variable is read. Debug there and see, if it is set to false or not

Regards,
Sandeep
thumbnail
Nilesh Gundecha, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
Hi Sandeep,

I tried from login.jsp checking the output for

GetterUtil.getBoolean(getInitParameter("add-process-action-success-action"), true)

This always returned true for me irrespective of whether I set true or false in portlet-custom.xml.

But when I tried this -
GetterUtil.getBoolean(getPortletConfig().getInitParameter("add-process-action-success-action"), true)

Then this is returning me the correct expected value.


As I navigated thru the LR Source, I found that LR is using the
GetterUtil.getBoolean(getInitParameter("add-process-action-success-action"), true)

which always returns true.

So if this is true, does this mean this is the bug in Liferay?

Regards,
Nilesh.
thumbnail
Ranga Rao Bobbili, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member Beiträge: 152 Beitrittsdatum: 20.07.07 Neueste Beiträge
One more solution, but i will remove message for all other operations. Create hook for html\common\themes\ portlet_messages.jspf.
Remove following content from portlet_messages.jspf.

<c:if test='<%= SessionMessages.contains(renderRequest, "request_processed") %>'>
<div class="portlet-msg-success">

<%
String successMessage = (String)SessionMessages.get(renderRequest, "request_processed");
%>

<c:choose>
<c:when test='<%= Validator.isNotNull(successMessage) && !successMessage.equals("request_processed") %>'>
<%= successMessage %>
</c:when>
<c:otherwise>
<liferay-ui:message key="your-request-processed-successfully" />
</c:otherwise>
</c:choose>
</div>
</c:if>
thumbnail
Nilesh Gundecha, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
Hi Ranga Rao,

Many Thanks for the help.

But I want to make it for only one portlet, that is Login Portlet.

Regards,
Nilesh.
thumbnail
jelmer kuperus, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
add-process-action-success-action wont work for any of the built in portlets. Its a setting used on portlets that extend from LiferayPortlet / MvcPortlet

For me the login portlet never shows the success message btw. When i log in it just shows "You are signed in as x"
thumbnail
Nilesh Gundecha, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
jelmer kuperus:
add-process-action-success-action wont work for any of the built in portlets. Its a setting used on portlets that extend from LiferayPortlet / MvcPortlet

For me the login portlet never shows the success message btw. When i log in it just shows "You are signed in as x"


Hi Jelmer,

Thanks for reply. I really didnt have any idea that add-process-action-success-action don't work for Built-in portlets.

I get the Success message in login portlet when I do the "Forgot Password". I wanted to disable it.

Thanks,

Nilesh.
thumbnail
jelmer kuperus, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
The only thing you can do is extend ForgotPasswordAction in ext and override addSuccessMessage(ActionRequest actionRequest, ActionResponse actionResponse) to do nothing

There is no configuration option that lets you disable the message
thumbnail
Nilesh Gundecha, geändert vor 12 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member Beiträge: 205 Beitrittsdatum: 01.12.09 Neueste Beiträge
Yeah. Thank you very much for all the support.
Anh Lee, geändert vor 11 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

New Member Beiträge: 4 Beitrittsdatum: 25.02.13 Neueste Beiträge
Thank for share Amos
fabian fernandez, geändert vor 9 Jahren.

RE: Prevent SessionMessages "Your request processed successfully."

New Member Beiträge: 5 Beitrittsdatum: 19.09.12 Neueste Beiträge
entonces, simplemente colocando:

addProcessActionSuccessMessage = false;

se logra el objetivo sin necesidad de reescribir el método.

muy útil!!!