0
我想通過portlet中的action方法提交表單並讀取它們,但返回的值是空的。這裏是我的代碼,我非常絕望,因爲我沒有看到任何錯誤。Portlet表單提交後字段爲空
<portlet:actionURL name="calculate" var="calculateAction" />
<form name="<portlet:namespace/>calculatorForm" action="${calculateAction}" method="post" enctype="application/x-www-form-urlencoded">
<table>
<tr>
<td><label for="<portlet:namespace/>date">Date</label></td>
<td><input type="text" name="<portlet:namespace/>date" id="<portlet:namespace/>date" /></td>
</tr>
<tr>
<td><label for="<portlet:namespace/>amount">Amount</label></td>
<td><input type="text" name="<portlet:namespace/>amount" id="<portlet:namespace/>amount" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Calculate" /></td>
</tr>
</table>
</form>
,我的方法是這樣的
@ProcessAction(name = "calculate")
public void calculate(ActionRequest request, ActionResponse response) {
String stringDate = request.getParameter("date");
String stringAmount = request.getParameter("amount");
System.out.println("Amount: " + stringAmount);
System.out.println("Date: " + stringDate);
}
方法正確調用,但是這兩個變量總是空。任何提示?謝謝
我有沒有命名空間相同的錯誤。但我肯定會嘗試這 – 2013-05-13 16:04:41
它實際上工作,謝謝 – 2013-05-14 11:54:26