PDA

View Full Version : Problems with FormPanel



juliano
11 Jul 2009, 3:49 PM
I have some troubles with FormPanel. The problem is that i don't receive in servlet what i send in client. That's my code.

I have the form panel inside a window.

form = new FormPanel();
form.setHeaderVisible(false);
form.setAction(GWT.getHostPageBaseURL()+"myServlet");
form.setMethod(Method.POST);
form.setEncoding(Encoding.MULTIPART);

pic = new FileUploadField();
pic.setFieldLabel("Image");
pic.setName("image");
form.add(pic);

message = new TextField<String>();
message.setFieldLabel("Message");
message.setMaxLength(50);
message.setName("message");
form.add(message);

add(form);

ok = new Button("Confirm");
ok.addSelectionListener(new SelectionListener<ButtonEvent>(){
public void componentSelected(ButtonEvent ce) {
form.submit();
}
});

getButtonBar().add(ok);In the servlet(not the GWT Service)

...
String message = (String) request.getAttribute("message");
...

I can get the image, but not the "message" so message is always null. I already try use a HiddenField in client to send the "message" but the result is the same.

Anyone can help me?