[英]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.