![](/img/trans.png)
[英]How to call Spring MVC Portlet Controller method by selecting value from a dropdown in jsp
[英]Spring mvc portlet: how to get data from jsp?
我有问题,如何将jsp(portlet)中html表单中的数据发送到控制器? 这里有一些代码
Portlet JSP
<form id="smsSender" method="post" action="${sendSmsUrl}">
<input type="text" name="phoneSuffix" maxlength="7"/>
<textarea id="message" maxlength="70" name="message"></textarea>
<br>
<input type="submit" value="Send">
</form>
<portlet:actionURL name="sendSms" var="sendSmsUrl">
</portlet:actionURL>
调节器
@Controller
@RequestMapping("VIEW")
public class SmsController extends MVCPortlet {
@ActionMapping
public void sendSms(ActionRequest request, ActionResponse response) {
String message = ParamUtil.get(request, "message", "");
}
}
请帮我了解如何正确执行操作? 谢谢!
问题似乎是由于portlet的限定参数所致:
可能的解决方案是:
一世。 使用aui html标签。
<aui:form id="smsSender" method="post" action="${sendSmsUrl}">
<aui:input type="text" name="phoneSuffix" maxlength="7" />
<aui:input type="textarea" id="message" maxlength="70" name="message" />
<br />
<aui:button type="submit" value="Send" />
</form>
要么
II。 将<portlet:namespace />
添加到字段名称属性中:
<textarea id="<portlet:namespace />message"
maxlength="70" name="<portlet:namespace />message"></textarea>
要么
III。 在liferay-portlet.xml中添加<requires-namespaced-parameters>false</requires-namespaced-parameters>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.