谁能解释一下,应该如何正确映射 POST 请求? API文档中并不清楚。
value应该赋给action参数javax.portlet.action的值
@ActionMapping(value = "addDocOrder")
public void addDocOrder(@ModelAttribute("order").......
接下来我们有“params”(JAVADOC:映射请求的参数,缩小主要映射范围。)
@ActionMapping(params = "action=addDocOrder")
public void addDocOrder(@ModelAttribute("order").......
JAVADOC for value() parameter of annotation: The name of the action, according to the Portlet 2.0 "javax.portlet.action" parameter. If not specified, the method will be used as default handler: i.e. for action requests where no specific action mapping was found. Note that all such annotated action methods only apply within the @RequestMapping constraints of the containing handler class.
我完全不明白“值”注释参数存在的意义是什么。它在那里毫无意义......它应该是主要映射,参数是次要映射,但是 {params = "action=addOrder"} 使“值”变得多余。
请:看看这个也相关的问题https://stackoverflow.com/questions/4782971/handling-ajax-requests-with-spring-portlet
最佳答案
我也同意你的评价。在阅读规范时我能看到的唯一真正优势是在标签中添加了一些特殊处理。显然这两个是等价的:
<portlet:actionURL>
<portlet:param name="javax.portlet.action" value="addDocOrder"/>
</portlet:actionURL>
<portlet:actionURL name="addDocOrder" />
这是来自规范中的“PLT.26.2 actionURL 标签”。
关于java - Spring portlet @ActionMapping 用法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4585710/