Discussions

Web tier: servlets, JSP, Web frameworks: Dynamic Page submission using Struts

  1. Dynamic Page submission using Struts (3 messages)

    Is there any way to submit a page dynamically using Struts tags?
    Right now I'm having two pages A & B.
    Page A calls an action class, which will call Page B on success

    Page A -> action class1 -> Page B

    But I would like to introduce an interim page A1 (between A & B), which will show some text message to the user.
    1. Page A calls an action class on submit, which will redirect to Page A1 (on success)
    2. Then Page A1 calls another action class dynamically (no user submission), which will re-direct to Page B.

    User Submitting Page A -> action class1 -> Auto Submission of Page A1 -> action class2 -> Page B

    Introducing Page A1 to show some text message to user, when the application processing at the back end.

    But I don't know how to submit Page A1 dynamically. Tried to submit using response.sendRedirect, RequestDispatcher & java script submission. But none of them solving my solutions. Is there any one help me on this?

    Thanks in advance
    Bala
  2. You can use JavaScript <body onLoad="document.forms[0].submit()">. In this way, the HTML form will be submitted automatically when the page is loaded.
  3. But then, as soon as the body loads the page will get submitted, what if you need to show the page for sometime?
  4. I believe you can do something like that:
    <body onLoad="load_html(document);">

    function load_html(document)
    {
      // then do auto-submit in 1 minutes (60000ms)
      setTimeout( "document.forms[0].submit()", 60000 );
    }