Tuesday, 10 September 2013

HttpServlet Request in method remoted by DWR

HttpServlet Request in method remoted by DWR

I have a Following JSP:
<form action="UploadServlet" method="post"
enctype="multipart/form-data">
Select file to upload: <input type="file" name="file" id
=upfile"size="50" /> <input type="button" value="Save"
onclick="javascript:uploadPartnerDetails();" class="buttons">
</form>
And DWR Script which calls remoted Java Method:
function uploadPartnerDetails() {
SMUDWR.uploadPartnerDetails(function(data) {
dwr.util.setValue("UserTypeDiv", data, {
escapeHtml: false
});
});
}
The Remoted Method uploadPartnerDetails()is:
try {
WebContext wctx = WebContextFactory.get();
HttpServletRequest request = wctx.getHttpServletRequest();
// checks if the request actually contains upload file
if (!ServletFileUpload.isMultipartContent(request)) {
// if not, we stop here
}
The Problem is the request above does not contain multipart/form-data. How
to I get that from this request?

No comments:

Post a Comment