正如我在对这个问题的回答的评论中提到的,问题出在 Liferay 6.2 上,因为 IBM WebSphere 和 Liferay 的早期版本正在按预期工作。
为了解决这个问题,我将元素添加<requires-namespaced-parameters>false</requires-namespaced-parameters>
到了portletliferay-portlet.xml
的目录中。/WEB-INF
通过这样做,HTML 表单的参数不是“命名空间”。
示例/WEB-INF/liferay-portlet.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<liferay-portlet-app>
<portlet>
<portlet-name>Portlet name</portlet-name>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
<instanceable>true</instanceable>
<ajaxable>false</ajaxable>
</portlet>
</liferay-portlet-app>
如果将此元素添加到 中liferay-portlet.xml
,portlet 在以前的 Liferay 版本中仍然可以正常工作(我使用版本 5.5 和 6.1 进行了测试)。它也适用于其他 portlet 包含,因为它们忽略此文件。
我声称 Liferay 的行为不正确,因为 JSR-286 规范说明了以下内容(在规范的第 76 页顶部):
如果 portlet 命名空间或编码 URL 参数或表单参数,它们还负责删除命名空间。portlet 容器不会删除 portlet 对这些参数所做的任何命名空间。”