我想從這個view.jsp的檢索textarea的數據如何檢索前一頁的TextArea值在JSP中?
<form action="${addStudentUrl}" method="post">
Name:<input name="name" type="text" />
<br>
<br>
Email:<input name="email" type="text" />
<br>
<br>
Gender:
<br>
<input type="radio" name="gender" value="1">Male<br>
<input type="radio" name="gender" value="2">Female
<br>
Description: <textarea id="description"> Enter text here...</textarea>
String description = $("description").val();
<input type="submit" value="Add"/>
</form>
要了這裏TestPackage.java
@ProcessAction(name="addStudent")
public void addStudent(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException, PortalException, com.liferay.portal.kernel.exception.SystemException
{
String name=ParamUtil.get(actionRequest, "name", StringPool.BLANK);
int gender=Integer.parseInt(ParamUtil.get(actionRequest, "gender", StringPool.BLANK));
String email=ParamUtil.get(actionRequest, "email", StringPool.BLANK);
String description = ParamUtil.get(actionRequest, "descriptionHidden", StringPool.BLANK);
StudentLocalServiceUtil.addStudent(name, gender, email, description);
}
我能爲性別,郵箱和姓名做。顯然textArea來自不同的數據類型。
當ID是'description',爲什麼你想檢索值回爲'descriptionHidden'? – Apurv 2013-04-23 09:49:29
爲什麼你不在表單中設置一個名稱=「描述」,然後以與其他字段相同的方式使用它? – 2013-04-23 09:51:59
我試試看。我仍然是編程的初學者。對不起,這幾個愚蠢的錯誤 – user2304995 2013-04-23 16:03:51