未从jquery提交调用的liferay portlet容器的操作方法

时间:2014-06-05 15:24:45

标签: jquery liferay

我正在尝试使用jquery submit()从javascript函数提交操作。 动作方法不会被调用,但会调用控制器的render方法。 当我在浏览器窗口中复制url字符串(来自firebug调试器"<%= deleteURL%>")时,将调用action方法。

从jquery

调用action方法需要什么

代码

>>>>>>jsp>>>>>>>>>

<pre><code>
<portlet:actionURL name="deleteObject" var="deleteURL" >
    <portlet:param name="action" value="deleteObject" />
</portlet:actionURL>


<script type="text/javascript">

function <portlet:namespace />deleteObject(id) {
    if (confirm('<%= UnicodeLanguageUtil.get(pageContext, "are-you-sure-you-want-to-delete-the-Object") %>')) {
        debugger;
        jQuery('<form />').attr('action', "<%=deleteURL%>").
            append(jQuery('<input>', {
            'name': 'objectId',
            'value': id,
            'type': 'hidden'
        })).appendTo('body').submit().remove();
    }
}

</script>

</code></pre>

>>>>>>java controller>>>>>>>>>

/**
     * Simply selects the home view to render by returning its name.
     */
    @RenderMapping
    public String render(Locale locale, Model model, RenderRequest req, RenderResponse res) {
        _log.info("Starting render: " + locale.toString());
        ...
        return "listObjects";
    }

    @ActionMapping(params = "action=deleteObject")
    public void deleteObject(Locale locale, Model model, PortletRequest req, PortletResponse res) throws PortalException, SystemException {
        _log.info("Starting deleteObject: " + locale.toString() + ":" + model);
        ....
    }

0 个答案:

没有答案