留言板

StrutsAction fragment is not calling super method!!

thumbnail
Abhishek Jain,修改在7 年前。

StrutsAction fragment is not calling super method!!

Regular Member 帖子: 226 加入日期: 16-8-20 最近的帖子
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,修改在7 年前。

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

Liferay Legend 帖子: 2416 加入日期: 10-12-22 最近的帖子
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,修改在7 年前。

RE: StrutsAction fragment is not calling super method!!

Regular Member 帖子: 226 加入日期: 16-8-20 最近的帖子
Thanks Andrew, you are right. It solved the problem.