There is no more error during start, but I can't send anything to my
server.

I do:
<servlet-mapping>
  <servlet-name>GameService</servlet-name>
  <url-pattern>/GameService</url-pattern>
</servlet-mapping>

And in my client code (package org.itech.client.content.games;):

        @Override
        public void buildContent()
        {
                // Create a FormPanel and point it at a service.
                final FormPanel form = new FormPanel();
                form.setAction("GameService");

                // Because we're going to add a FileUpload widget, we'll need 
to set
the
                // form to use the POST method, and multipart MIME encoding.
                form.setEncoding(FormPanel.ENCODING_MULTIPART);
                form.setMethod(FormPanel.METHOD_POST);

                // Create a panel to hold all of the form widgets.
                visualComponent = new VerticalPanel();
                form.setWidget(visualComponent);

                final String[] label = new String[]{ "Title of game: ", 
"Developer:
", "Language: " };
                Grid grid = new Grid(label.length+2,2);
                grid.setCellSpacing(4);

                for (int i=0; i < label.length; ++i)
                {
                        grid.setWidget(i,0,new Label(label[i]));
                        grid.setWidget(i,1,new TextBox());
                }

                grid.setWidget(label.length,0,new Label("Game file: "));
                grid.setWidget(label.length,1,new FileUpload());

                // Add a 'submit' button.
                grid.setWidget(label.length+1,1,new Button("Submit", new
ClickListener()
                {
                        public void onClick(Widget sender)
                        {
                                form.submit();
                        }
                }));
                visualComponent.add(grid);

                // Add an event handler to the form.
                form.addFormHandler(new FormHandler()
                {
                        public void onSubmit(FormSubmitEvent event)
                        {
                                System.out.println("onSubmit");
                        }

                        public void onSubmitComplete(FormSubmitCompleteEvent 
event)
                        {
                                System.out.println("onSubmitComplete");
                        }
                });
        }

My server code (package org.itech.server.games;):

        protected void service(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException
        {
                System.err.println("Servlet");
                if (!ServletFileUpload.isMultipartContent(request))
                        return;

                FileItemFactory factory  = new DiskFileItemFactory();
                ServletFileUpload upload = new ServletFileUpload(factory);

                List items = null;
                try
                {
                        items = upload.parseRequest(request);
                }
                catch (FileUploadException e)
                {
                        e.printStackTrace();
                        return;
                }

                for (Iterator i = items.iterator(); i.hasNext();)
                {
                        FileItem item = (FileItem) i.next();

                        if (item.isFormField())
                                continue;

                        System.out.println("Received:");
                        System.out.println("  Fieldname:   " + 
item.getFieldName());
                        System.out.println("  ContentType: " + 
item.getContentType());
                        System.out.println("  Name:        " + item.getName());
                }
        }

Where is the mistake?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to