Note that there are some explanatory texts on larger screens.

plurals
  1. POgwt-gwt 3.0 file upload issue with Spring MVC
    primarykey
    data
    text
    <p>I'm having a problem getting the file object when I use FormPanel, FileUploadField, and Spring.</p> <p>Here is what I have:</p> <p>I added the CommonsMultipartResolver bean to my Spring Context file:</p> <pre><code>&lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"&gt; &lt;property name="maxUploadSize" value="100000"/&gt; &lt;/bean&gt; </code></pre> <p>I have a model class with the regular getters and setters:</p> <pre><code>pulic class UploadItem{ private String filename; private CommonsMultipartFile fileData; .... getters/setters .... } </code></pre> <p>My controller class:</p> <pre><code>@Controller @RequestMapping("/Foo") public class ThingController extends BaseController implements ServlerContextAware{ .... @RequestMapping(value = "/bar", method = RequestMethod.POST) public @ResponseBody String createFile(UploadItem item, BindingResults results){ String orgFile = item.getFileData().getOriginalFilename(); return orgFile; } </code></pre> <p>I'm using UiBinding to create the form fields, but I'm calling the fileupload field and formpanel to add the other methods in code.</p> <p>I have a submit button that calls:</p> <pre><code> form.submit(); </code></pre> <p>And my constructor I take care of the other form requirements:</p> <pre><code> form.setMethod(Method.POST); form.setEncoding(Encoding.MULTIPART); form.setAction("http://url.com/foo/bar"); form.addSubmitCompleteHandler(new SubmitCompleteHandler(){ @Override public void onSubmitComplete(SubmitCompleteEvent event){ String results = event.getResults(); Info.display("Upload Response", results); } }); </code></pre> <p>When I run the code I get a nullpointerexecption on item.getFileData().getOriginalFilename();</p> <p>I don't know what the problem is. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload