How have you attached the panel?

RootPanel.get().add(uploadPanel );

On Oct 30, 4:35 pm, grasshopper <[EMAIL PROTECTED]> wrote:
> mon3y,
>
> No. Not getting alert popping up after i click on submit.
>
> Looking through GWT Group discussions i found a discussion/thread
> which helped me realize i was making a mistake in my code. I was
> attaching the uploadPanel not the uploadForm to the page. However,
> despite some progress, now that i attach the form and not the vertical
> panel. The form with the panel as a widget does not show/display.
>
> On Oct 30, 10:13 am, mon3y <[EMAIL PROTECTED]> wrote:
>
> > do u get the window alert popping up after u click on submit?
>
> > On Oct 29, 8:24 pm, grasshopper <[EMAIL PROTECTED]> wrote:
>
> > > I am trying to set up file uploading in an app and I am having trouble
> > > with no sign of what is wrong.
>
> > > My trouble is that when I click a button to submit a FormPanel,
> > > nothing happens.
>
> > > To make matters worst I get no error on tomcat logs or anywhere.
>
> > > I am clueless as to what might be happenning.
>
> > > This is my onModuleLoad() code:
> > > //Create a FormPanel and point it at a service.
> > >     final FormPanel uploadForm = new FormPanel();
> > >     uploadForm.setAction(GWT.getModuleBaseURL() +
> > > "wallpaperUploadService");
>
> > >     // 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.
> > >     uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
> > >     uploadForm.setMethod(FormPanel.METHOD_POST);
>
> > >     // Create a panel to hold all of the form widgets.
> > >     VerticalPanel uploadPanel = new VerticalPanel();
> > >     uploadForm.setWidget(uploadPanel);
>
> > >     // Create a FileUpload widget.
> > >     FileUpload upload = new FileUpload();
> > >     upload.setName("uploadFormElement");
> > >     uploadPanel.add(upload);
>
> > >     // Add a 'submit' button.
> > >     Button uploadSubmitButton = new Button("Submit");
> > >     uploadPanel.add(uploadSubmitButton);
>
> > >     uploadSubmitButton.addClickListener(new ClickListener() {
> > >       public void onClick(Widget sender) {
> > >         uploadForm.submit();
> > >       }
> > >     });
>
> > >     uploadForm.addFormHandler(new FormHandler() {
> > >       public void onSubmit(FormSubmitEvent event) {
> > >       }
>
> > >       public void onSubmitComplete(FormSubmitCompleteEvent event) {
> > >         Window.alert(event.getResults());
> > >       }
> > >     });
>
> > > My servlet is code:
> > > public class WallpaperUploadServlet extends HttpServlet implements
> > > Servlet {
>
> > >          public void init(ServletConfig config) throws ServletException{
>
> > >          }
>
> > >         protected void doPost(HttpServletRequest request, 
> > > HttpServletResponse
> > > response)
> > >               throws ServletException, IOException {
> > >             response.setContentType("text/plain");
>
> > >             FileItem uploadItem = getFileItem(request);
> > >             if (uploadItem == null) {
> > >               response.getWriter().write("NO-SCRIPT-DATA");
> > >               return;
> > >             }
>
> > >             byte[] fileContents = uploadItem.get();
> > >             //TODO: add code to process file contents here. We will just
> > > print it.
>
> > >             //System.out.println(new String(fileContents));
> > >             response.getWriter().write("GOT-DATA");
> > >           }
>
> > >         private FileItem getFileItem(HttpServletRequest request) {
> > >             FileItemFactory factory = new DiskFileItemFactory();
> > >             ServletFileUpload upload = new ServletFileUpload(factory);
>
> > >             try {
> > >               List items = upload.parseRequest(request);
> > >               Iterator it = items.iterator();
> > >               while (it.hasNext()) {
> > >                 FileItem item = (FileItem) it.next();
> > >                 if (!item.isFormField()
> > >                     && "uploadFormElement".equals(item.getFieldName())) {
> > >                   return item;
> > >                 }
> > >               }
> > >             } catch (FileUploadException e) {
> > >               return null;
> > >             }
> > >             return null;
> > >           }
>
> > > }
>
> > > web.xml:
> > >  <servlet>
> > >            <servlet-name>WallpaperUploadService</servlet-name>
> > >            <servlet-class>
>
> > > net.newfoundcomm.attendant.server.WallpaperUploadServlet
> > >            </servlet-class>
>
> > >            <init-param>
> > >                <param-name>action-class</param-name>
>
> > >                <!-- Replace the action class name below with the fully
> > > qualified name of the action class -->
> > >                <param-
> > > value>net.newfoundcomm.attendant.WallpaperUploadActionClass</param-
> > > value>
> > >            </init-param>
> > >        </servlet>
>
> > >        <servlet-mapping>
> > >            <servlet-name>WallpaperUploadService</servlet-name>
> > >            <url-pattern>/wallpaperUploadService</url-pattern>
> > >        </servlet-mapping>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to