【发布时间】:2015-08-01 07:08:07
【问题描述】:
我正在使用 Liferay 6.2,我想修改 GetPageAttachmentAction。
我想在strutsExecute 中添加以下代码以在文件名中包含标题:
public ActionForward strutsExecute(
ActionMapping actionMapping, ActionForm actionForm,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
long nodeId = ParamUtil.getLong(request, "nodeId");
String title = ParamUtil.getString(request, "title");
String fileName = ParamUtil.getString(request, "fileName");
// Here my change:
int pos = fileName.indexOf(CharPool.SLASH);
if (pos >= 0) {
title = fileName.substring(0, pos);
fileName = fileName.substring(pos + 1);
}
...
如果我通过使用自定义类扩展 BaseStrutsPortletAction 来为此更改创建挂钩插件,则它不会提供 strutsExecute() 来覆盖。
我应该改用 Ext 插件吗?如果是,那么建议我配置Ext插件来修改GetPageAttachmentAction。
【问题讨论】:
-
您能在
strutsExecute中显示您想要更改的内容吗? -
我想在 strutExecute() 方法调用的 getFile() 方法中添加代码来分隔文件 wiki 标题和文件名。所以我想添加以下代码 int pos = fileName.indexOf(CharPool.SLASH); if (pos != -1) { title = fileName.substring(0, pos);文件名 = 文件名.substring(pos + 1); }
-
我将这些信息整合到您的问题中