Hi,
I am developing a portlet with vaadin. Now I have to use FileUpload (org.apache.commons).
My approach was to use a form in a label (simplified example):
public class VaadinasmtestApplication extends Application implements PortletListener{
private String form = "<portlet:actionURL var=\"submitUrl\" />" +
"<form method=\"post\" action=\"${submitUrl}\" enctype=\"multipart/form-data\">" +
"<input type=\"file\" name=\"inputFile\" id=\"inputFile\">" +
"<input type=\"submit\" name=\"Submit\" value=\"Upload\">" +
"</form>";
private Label upload = new Label(form, Label.CONTENT_RAW);
@Override
public void init() {
if (getContext() instanceof PortletApplicationContext2) {
PortletApplicationContext2 ctx = (PortletApplicationContext2) getContext();
ctx.addPortletListener(this, this);
}
Window mainWindow = new Window("Vaadin-ASM-Test");
setMainWindow(mainWindow);
getMainWindow().addComponent(upload);
}
@Override
public void handleRenderRequest(RenderRequest request,
RenderResponse response, Window window) {
System.out.println("calling handleRenderRequest...");
}
@Override
public void handleActionRequest(ActionRequest request,
ActionResponse response, Window window) {
System.out.println("calling handleActionRequest...");
//Code to handle the upload
}
@Override
public void handleEventRequest(EventRequest request,
EventResponse response, Window window) {
System.out.println("calling handleEventRequest...");
}
@Override
public void handleResourceRequest(ResourceRequest request,
ResourceResponse response, Window window) {
System.out.println("calling handleResourceRequest...");
}
}
But the “handleActionRequest”-method is not called. I think I have to access the “processAction”-Method to get to the uploaded file.
Can someone help me?
Sincerely, Johannes