Classico
Classico

Reputation: 111

Alert window after submiting FormPanel

I have next problem... when i submit form and my Post method end. Form(or not)throwing empty alert window. how can I delete this throwing window?

ClienSide

 ....            
        final FormPanel form = new FormPanel();
        form.setAction(GWT.getModuleBaseURL()+"upload");

        form.setEncoding(FormPanel.ENCODING_MULTIPART);
        form.setMethod(FormPanel.METHOD_POST);

        VerticalPanel panel = new VerticalPanel();
        form.setWidget(panel);

        FileUpload upload = new FileUpload();
        upload.setName("uploadFormElement");
        panel.add(upload);

        fileButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit();
            }
        });

FileUploadServlet

public class FileUploadServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        super.doGet(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {


        if (ServletFileUpload.isMultipartContent(req)) {   
            FileItemFactory factory = new DiskFileItemFactory();
            ServletFileUpload upload = new ServletFileUpload(factory);

            try {
                List<FileItem> items = upload.parseRequest(req);
                for (FileItem fileItem : items) {
                    if (fileItem.isFormField()) continue;
                    String fileName = fileItem.getName();
                    if (fileName != null) {
                        fileName = FilenameUtils.getName(fileName);
                    }
                    File uploadedFile = new File("test.txt");
                    if (uploadedFile.createNewFile()) {
                        fileItem.write(uploadedFile);
                    }

                }
            } catch (FileUploadException e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

Maybe someone knows the reason of this alert?

Upvotes: 0

Views: 141

Answers (1)

appbootup
appbootup

Reputation: 9537

If it is a simple Javascript alert window you need to track/search for it in three places

Steps - Search for alert string across client code

1) In javascript - third party .js file . String search for `alert` in such js files

2) In third party gwt jar . 
 a) String search for Window.alert in the GWT java code
 b) String search for wnd.alert in GWT jsni code

3) In Your own source code - repeat steps "a" and "b" from Step 2

It is unlikely but also string search you server side code base if in case they are building a string in response and displaying it via some other mechanism.

Upvotes: 3

Related Questions