Thursday, October 28, 2010

gwt FormPanel & servlet integration

I'm just writing a simple FormPanel and a servlet that handle it.
However, there is a problem while getting parameter from FormPanel.
What I want to say :

formPanel = new FormPanel();
formPanel.setAction(ACTION_URL);
formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setMethod(FormPanel.METHOD_POST);

absolutePanel = new AbsolutePanel();
formPanel.setWidget(absolutePanel);
absolutePanel.setSize("348px", "100%");

nameField = new TextBox();
absolutePanel.add(nameField, 94, 50);
nameField.getElement().setId("name");
nameField.setName("name");
When I tried to get the name value from the servlet it returns null :

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

System.out.println(req.getParameter("name")); // null! why?
}

What is the problem with that code? How can I get the value from gwt
FormPanel in servlet?

Thanks,

//http://stackoverflow.com/questions/4049312/gwt-formpanel-servlet-
integration

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment