- Using SmartGWT2.4 on ie8
Im uploading docs as below and using a servlet to process the files and upload it to a directory.But I want to show the user the error message if the directory is not available.Right now its not getting into catchblock of smartgwt code.Exception is thrown from servlet.Any help appreciated.
Steps taken
set encoding to “multipart”
include an UploadItem to get a basic HTML upload control
set action to a URL where you have deployed server-side code to handle the upload
call DynamicForm.submitForm to cause the form to be submitted
try{
uploadForm().submitForm();
}
catch (Exception e) {
System.out.println("Error Occured uploading the document(s)");
SC.say("Error Occured uploading the document(s).");
}
Servlet Sample Code
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException {
try{
List<FileItem> items = upload.parseRequest(request);
for (FileItem fileItem : items) {
//FileUpload Logic
}
}
catch (Exception e) {
throw new RuntimeException("Error Occured uploading the document(s).");
}