Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Perform Submit in Dynamic Form

    SmartGWT 2.4
    IE 8.0

    Hi, I'm trying to perform a form submit but when a click into my submit button, nothing happens. No js error or anything... I've a break point in my servlet but never can reach it...

    My cliente code:

    DynamicForm form = new DynamicForm();
    form.setMethod(FormMethod.POST);
    form.setCanSubmit(true);
    String url = GWT.getModuleBaseURL() + "submitServlet";
    form.setAction(url);
    HiddenItem hidIt= new HiddenItem("somehidden");
    hidIt.setValue("My secret value");
    form.setFields(hidIt);
    form.submitForm();

    My web.xml:
    <servlet>
    <servlet-name>xmlExportServlet</servlet-name>
    <servlet-class>bdl.bps.com.uy.server.MyServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>xmlExportServlet</servlet-name>
    <url-pattern>/appSMGWT/submitServlet</url-pattern>
    </servlet-mapping>

    MyServlet.java:

    public class MyServlet extends HttpServlet {

    public MyServlet() {
    super();
    }

    @Override
    public void init() throws ServletException {
    super.init();
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    export(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    export(request, response);
    }

    private void export(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String xml = request.getParameter("xml");
    response.setContentType("application/xml");
    response.setHeader( "Content-Disposition", "attachment; filename=Test.xml" );
    response.setContentLength(xml.length());
    IOUtils.write(xml, response.getOutputStream(),"ISO-8859-1");
    }
Working...
X