Question

I'm trying to setup the gwtupload widget with uiBinder and I'm having a hard time getting this configured.

I got the code working with the regular gwt-fileUpload widget, but I wanted the gwtupload because of it's richer functionality. Here is what I did for the gwt-fileUpload widget:

    @UiHandler("calculateComplexityButton")
    void onClickCalculateComplexity(ClickEvent e){
        formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        formPanel.setMethod(FormPanel.METHOD_POST);
        formPanel.setAction(UPLOAD_ACTION_URL);
        String fileName = fileUpload.getFilename();
        fileUpload.setName(fileName);
        formPanel.submit();
    }

I'm not seeing how to setup the same thing with gwtupload. I'm seeing this error:

HTTP ERROR: 404 NOT_FOUND
RequestURI=/servlet.gupld

I don't understand how to map the gwtupload widget to my servletPath, because I'm configuring it under uiBinder?

Was it helpful?

Solution

In order to set the servletPath, you must first

  1. Set up a custom ui namespace, ie I used "up" below:
  2. Define the servletPath in the widget definition itself.

    <up:MultiUploader type="LABEL" ui:field="uploader" 
      servletPath="/...     /SampleUploadServlet" 
      styleName="{style.myup}" maximumFiles="2" 
      avoidRepeatFiles="true"   validExtensions="xml"/>
    
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top