您好我正在尝试获取其他java文件中的文本字段的值。我正在尝试下面的代码。
<aui:form action="<%=editpollURL.toString() %>" enctype="multipart/form-data"
method="post" >
<aui:input name="title" label="title"/>
<aui:input type="textarea" name="pollquestion" rows="5" cols="25" label="Poll
Question" />
以下是我的java代码。
String title = ParamUtil.getString(actionRequest, "title");
String pollquestion = ParamUtil.getString(actionRequest, "pollquestion");
System.out.println("Your inputs ==> " + title + ", " + pollquestion);
我无法从jsp文件中写入用户输入。请帮助我。
答案 0 :(得分:0)
对于您的情况,您应该使用UploadPortletRequest:
public void yourAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(request);
String filePath = uploadRequest.getFileName("filePath");
try{
java.io.File file = uploadRequest.getFile("filePath");
//Manage the Upload
}catch (Exception e) {
///
}
}
你的jsp输入可能是:
<aui:input type="file" label="upload your file" name="filePath" />
确保使用匹配的“name”属性,并使用'type =“file”'