我想从此 view.jsp 中检索 textarea 数据
<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 来自不同的数据类型。