Fórum

StrutsAction fragment is not calling super method!!

thumbnail
Abhishek Jain, modificado 7 Anos atrás.

StrutsAction fragment is not calling super method!!

Regular Member Postagens: 226 Data de Entrada: 20/08/16 Postagens Recentes
I am implementing struts action hook in liferay 7 ce ga1. The code for the same is as follows:-
@Component(
 immediate=true,
 property={
 "path=/portal/login"
 },
 service = StrutsAction.class
)
public class CustomTermsOfUseAction extends BaseStrutsAction {
 
 @Override
 public String execute(StrutsAction originalStrutsAction, HttpServletRequest request, HttpServletResponse response)
 throws Exception {
  System.out.println("Calling Custom Termsof Use Action");
  //you logic goes here
  return super.execute(originalStrutsAction, request, response);
 }

}


I got the blank page on the browser whereas the message gets printed onto the console i.e it is not calling super method(). Can you tell me how to call the default functionality of liferay? Please help... thanx in advance..
thumbnail
Andrew Jardine, modificado 7 Anos atrás.

RE: StrutsAction fragment is not calling super method!! (Resposta)

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Abhishek,

Try changing the way you call the super -- in fact you don't want to call super, usually you want to call the original action.

@Component(
  immediate=true,
  property={
  "path=/portal/login"
  },
  service = StrutsAction.class
)
public class CustomTermsOfUseAction extends BaseStrutsAction {
 
 @Override
 public String execute(StrutsAction originalStrutsAction, HttpServletRequest request, HttpServletResponse response)
 throws Exception {
  System.out.println("Calling Custom Termsof Use Action");
  //you logic goes here
  return originalStrutsAction.execute(originalStrutsAction, request, response);
 }

}


Can you give that a shot and let us know if that solves your issue?
thumbnail
Abhishek Jain, modificado 7 Anos atrás.

RE: StrutsAction fragment is not calling super method!!

Regular Member Postagens: 226 Data de Entrada: 20/08/16 Postagens Recentes
Thanks Andrew, you are right. It solved the problem.