掲示板

Prevent SessionMessages "Your request processed successfully."

thumbnail
13年前 に Corné Aussems によって更新されました。

Prevent SessionMessages "Your request processed successfully."

Liferay Legend 投稿: 1313 参加年月日: 06/10/03 最新の投稿
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
13年前 に Nagendra Kumar Busam によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Master 投稿: 678 参加年月日: 09/07/07 最新の投稿
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
13年前 に Amos Fong によって更新されました。

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

Liferay Legend 投稿: 2047 参加年月日: 08/10/07 最新の投稿
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
13年前 に Corné Aussems によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend 投稿: 1313 参加年月日: 06/10/03 最新の投稿
Thanks for sharing Amos
thumbnail
13年前 に Sandeep Nair によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
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
12年前 に Nilesh Gundecha によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
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
12年前 に Sandeep Nair によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
Which version of liferay are you using. It will work if you are using GenericPortlet.
thumbnail
12年前 に Nilesh Gundecha によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
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
12年前 に Sandeep Nair によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend 投稿: 1744 参加年月日: 08/11/06 最新の投稿
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
12年前 に Nilesh Gundecha によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
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
12年前 に Ranga Rao Bobbili によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member 投稿: 152 参加年月日: 07/07/20 最新の投稿
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
12年前 に Nilesh Gundecha によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
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
12年前 に jelmer kuperus によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend 投稿: 1191 参加年月日: 10/03/10 最新の投稿
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
12年前 に Nilesh Gundecha によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
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
12年前 に jelmer kuperus によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Liferay Legend 投稿: 1191 参加年月日: 10/03/10 最新の投稿
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
12年前 に Nilesh Gundecha によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

Regular Member 投稿: 205 参加年月日: 09/12/01 最新の投稿
Yeah. Thank you very much for all the support.
11年前 に Anh Lee によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

New Member 投稿: 4 参加年月日: 13/02/25 最新の投稿
Thank for share Amos
9年前 に fabian fernandez によって更新されました。

RE: Prevent SessionMessages "Your request processed successfully."

New Member 投稿: 5 参加年月日: 12/09/19 最新の投稿
entonces, simplemente colocando:

addProcessActionSuccessMessage = false;

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

muy útil!!!