Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Liferay 6 进行开发。
我有一个关于扩展MVCPortlet类和提供方法的查询。
MVCPortlet
在某些示例中,在扩展MVCPortlet和提供自定义方法时,是否必须为方法提供参数,ActionRequest如下ActionResponse所示:
ActionRequest
ActionResponse
public void addBook(ActionRequest request, ActionResponse response) { }
所以我的问题是,这种语法是强制性的吗?
提前致谢。
是的,这是强制性的,因为它实现了一个动作处理程序。您还可以使用相同的参数覆盖 GenericPortlet 的 processAction 或使用 @ProcessAction 注释,但在所有情况下,您都必须有办法将实际请求传递到 portlet。这就是参数的用途。
如果不提供参数,MVCPortlet 对实际操作名称的基于反射的解析将找不到该方法。