Foros de discusión

trying to override MVCActionCommand LR7 GA2 Windows

thumbnail
Mohammad Danish, modificado hace 7 años.

trying to override MVCActionCommand LR7 GA2 Windows

Regular Member Mensajes: 187 Fecha de incorporación: 5/03/12 Mensajes recientes
Hi,

I am trying to override the existing MVCActionCommand. Below is my code for the same.
@Component(immediate = true, property = { "javax.portlet.name=" + LoginPortletKeys.LOGIN,
		"javax.portlet.name=" + LoginPortletKeys.FAST_LOGIN,
		"mvc.command.name=/login/login" }, service = MVCActionCommand.class)
public class LoginMVCActionCommand extends BaseMVCActionCommand {

	@Reference(target = "(&(mvc.command.name=/login/login)(javax.portlet.name=+" + LoginPortletKeys.LOGIN
			+ ") (javax.portlet.name=" + LoginPortletKeys.FAST_LOGIN + "))")
	public void setMvcActionCommand(MVCActionCommand mvcActionCommand) {
		this.mvcActionCommand = mvcActionCommand;
	}

	public MVCActionCommand getMvcActionCommand() {
		return this.mvcActionCommand;
	}

	protected MVCActionCommand mvcActionCommand;

	@Override
	protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
		System.out.println("#############################LoginMVCActionCommand.processAction()##################################");
		mvcActionCommand.processAction(actionRequest, actionResponse);

	}

}


My Gradel File is as follows
dependencies {
	compile 'com.liferay.portal:com.liferay.portal.kernel:2.0.0'
	compile 'javax.portlet:portlet-api:2.0'
	compile 'org.osgi:org.osgi.service.component.annotations:1.3.0'
	compile group: "com.liferay", name: "com.liferay.login.web", version: "1.0.5"
	compile group: "com.liferay", name: "com.liferay.blogs.web", version: "1.0.11"
}


When I deploy and login, nothing comes up in the console. I tried by logging in using the FAST_LOGIN and normal LOGIN.

It something I am missing in the above code?
Raghuveer Kanakamedala, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

New Member Mensajes: 5 Fecha de incorporación: 29/07/13 Mensajes recientes
I have the same problem with Enterprise 7.0 GA1 + Fixpack 2. Any ideas?
Raghuveer Kanakamedala, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

New Member Mensajes: 5 Fecha de incorporación: 29/07/13 Mensajes recientes
I have tried below changes and seem to work
  • Change the service.ranking:Integer value to much higher say 500
  • Export the package through bnd.bnd file in which your Override class exists
thumbnail
Mohammad Danish, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Regular Member Mensajes: 187 Fecha de incorporación: 5/03/12 Mensajes recientes
Raghuveer Kanakamedala:
I have tried below changes and seem to work
  • Change the service.ranking:Integer value to much higher say 500
  • Export the package through bnd.bnd file in which your Override class exists


Hi Raghuveer,

I had done the things ass suggested by you.
My bnd.bnd contains the following entry.
Export-Package: com.my.liferay.action.hook
Added the property "service.ranking:Integer=1000"
Still it is not getting called.

Can you please post your project here, which is working for you?
thumbnail
Gaurav Jain, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Junior Member Mensajes: 85 Fecha de incorporación: 12/07/16 Mensajes recientes
Mohammad Danish:
Raghuveer Kanakamedala:
I have tried below changes and seem to work
  • Change the service.ranking:Integer value to much higher say 500
  • Export the package through bnd.bnd file in which your Override class exists


Hi Raghuveer,

I had done the things ass suggested by you.
My bnd.bnd contains the following entry.
Export-Package: com.my.liferay.action.hook
Added the property "service.ranking:Integer=1000"
Still it is not getting called.

Can you please post your project here, which is working for you?


Hi Mohammad Danish,

service.ranking:Integer=1000 try setting this property inside @Component properties of LoginMVCActionCommand class for ex:

@Component(
immediate = true,
property = {
"javax.portlet.name=" + LoginPortletKeys.LOGIN,
"javax.portlet.name=" + LoginPortletKeys.FAST_LOGIN,
"mvc.command.name=/login/login",
"service.ranking:Integer=100"
},
service = MVCActionCommand.class
)
sedki jdaida, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Junior Member Mensajes: 25 Fecha de incorporación: 8/09/16 Mensajes recientes
Hi Gaurav Jain,

Its works very sucessful but do you have idea when i add a new attribute in form of customise create_account.jsp like "ssn" and when i would like to recuperate the value of this attribute in "CreateAccountMVCActionCommand.java".


i write some code but the value of this value is null.

help me and thanks/.

Archivos adjuntos:

thumbnail
Gaurav Jain, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Junior Member Mensajes: 85 Fecha de incorporación: 12/07/16 Mensajes recientes
Hi sedki jdaida,
I am not sure but try using actionRequest.getParameter("ssn"); instead of using request.getParameter("ssn");.

You can also try ParamUtil.getString(actionRequest, "ssn");
And let me know if it works.
sedki jdaida, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Junior Member Mensajes: 25 Fecha de incorporación: 8/09/16 Mensajes recientes
Hi Gaurav Jain,

thanks Gaurav Jain,
I find a solution .

juste put this code in CreateAccountMVCActionCommand.java
String ssnValue = (String)PortalUtil.getExpandoValue(actionRequest, "ExpandoAttribute--" + "ssn" + "--", ExpandoColumnConstants.STRING, ExpandoColumnConstants.PROPERTY_DISPLAY_TYPE_TEXT_BOX);emoticon
thumbnail
Gaurav Jain, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Junior Member Mensajes: 85 Fecha de incorporación: 12/07/16 Mensajes recientes
Hi sedki jdaida,

Seems like you are using liferay's tag for custom-attributes in your jsp. Then it will be done in manner you specified.
thumbnail
Mohammad Danish, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Regular Member Mensajes: 187 Fecha de incorporación: 5/03/12 Mensajes recientes
@Component(
immediate = true,
property = {
"javax.portlet.name=" + LoginPortletKeys.LOGIN,
"javax.portlet.name=" + LoginPortletKeys.FAST_LOGIN,
"mvc.command.name=/login/login",
"service.ranking:Integer=100"
},
service = MVCActionCommand.class
)

Thanks for your response.
Still it is not working for me. I had attached the zip file of my project. Can you please have a look on what I am missing. would be very helpfull.
Thansk

Archivos adjuntos:

thumbnail
Gaurav Jain, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Junior Member Mensajes: 85 Fecha de incorporación: 12/07/16 Mensajes recientes
Mohammad Danish:

Still it is not working for me.


Hi Danish,

It looks like you are trying to override com.liferay.login.web.portlet.action.LoginMVCActionCommand class. I made some simple modifications in string concatenation. And this attached file is working at my end.

PFA

if it still does not work , Can you please specify if there is any error you are getting? Or if your custom class is not being hit? What is the state of your module, when you try lb? Try refreshing your module from gogo with refresh [module-id]. What is the actual problem you are getting?
thumbnail
Mohammad Danish, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Regular Member Mensajes: 187 Fecha de incorporación: 5/03/12 Mensajes recientes
Thanks bro..
Turns out to be a typo

@Reference(target = "(&(mvc.command.name=/login/login)(javax.portlet.name=+" + LoginPortletKeys.LOGIN
I was having an extra + in the module name list.
thumbnail
Ravi Darji, modificado hace 7 años.

RE: trying to override MVCActionCommand LR7 GA2 Windows

Junior Member Mensajes: 56 Fecha de incorporación: 14/05/14 Mensajes recientes
Hi Gaurav,

In this thread you are discussing about /login/login strut action.
i want to add one more jsp in hook and that jsp i want to call from login.jsp using render url.

Can you suggest me what should i need to do?
i am using liferay 7 fragment.

Thanks & Regards,
Ravi Darji