Hi

"myFormHandler" would be your server side class name.

in your xml file you would write something like this

<servlet-name>myFormHandler</servlet-name>
  <servlet-class>net.myapp.server.servlets.myFormHandler</servlet-
class>
  </servlet>
 <servlet-mapping>
  <servlet-name>myFormHandler</servlet-name>
  <url-pattern>/myFormHandler</url-pattern>
  </servlet-mapping>

So every time you submit your form it would go to that server mapping.

Something along those lines.
HTH
:).
On Sep 23, 9:06 am, GumbyGWTBeginner <[email protected]>
wrote:
> Hi,
>
> The example below uses the FileUpload Class for sending a file to the
> Server.
>
> My question (being very new at this) where and how do I write my
> Service  (in this case     form.setAction("/myFormHandler");).
>
> If my question is clear.....
>
> Stephan
>
> public class FormPanelExample implements EntryPoint {
>
>   public void onModuleLoad() {
>     // Create a FormPanel and point it at a service.
>     final FormPanel form = new FormPanel();
>     form.setAction("/myFormHandler");
>
>     // 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.
>     VerticalPanel panel = new VerticalPanel();
>     form.setWidget(panel);
>
>     // Create a TextBox, giving it a name so that it will be
> submitted.
>     final TextBox tb = new TextBox();
>     tb.setName("textBoxFormElement");
>     panel.add(tb);
>
>     // Create a ListBox, giving it a name and some values to be
> associated with
>     // its options.
>     ListBox lb = new ListBox();
>     lb.setName("listBoxFormElement");
>     lb.addItem("foo", "fooValue");
>     lb.addItem("bar", "barValue");
>     lb.addItem("baz", "bazValue");
>     panel.add(lb);
>
>     // Create a FileUpload widget.
>     FileUpload upload = new FileUpload();
>     upload.setName("uploadFormElement");
>     panel.add(upload);
>
>     // Add a 'submit' button.
>     panel.add(new Button("Submit", new ClickListener() {
>       public void onClick(Widget sender) {
>         form.submit();
>       }
>     }));
>
>     // Add an event handler to the form.
>     form.addFormHandler(new FormHandler() {
>       public void onSubmit(FormSubmitEvent event) {
>         // This event is fired just before the form is submitted. We
> can take
>         // this opportunity to perform validation.
>         if (tb.getText().length() == 0) {
>           Window.alert("The text box must not be empty");
>           event.setCancelled(true);
>         }
>       }
>
>       public void onSubmitComplete(FormSubmitCompleteEvent event) {
>         // When the form submission is successfully completed, this
> event is
>         // fired. Assuming the service returned a response of type
> text/html,
>         // we can get the result text here (see the FormPanel
> documentation for
>         // further explanation).
>         Window.alert(event.getResults());
>       }
>     });
>
>     RootPanel.get().add(form);
>   }
>
>
>
>
>
> }
--~--~---------~--~----~------------~-------~--~----~
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