0

您好,我正在尝试获取其他 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 文件中写入用户输入。请帮助我。

4

1 回答 1

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" />

确保使用匹配的“名称”属性,并使用 'type="file"'

于 2013-04-17T11:55:50.313 回答