Meaningless Drivel is fun!
The moose likes Struts and the fly likes Dynamic Submission of a page using Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamic Submission of a page using Struts" Watch "Dynamic Submission of a page using Struts" New topic

Dynamic Submission of a page using Struts

Bala Raj
Ranch Hand

Joined: Sep 12, 2000
Posts: 75
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. Is there any one help me on this?
Thanks in advance.
[ April 25, 2003: Message edited by: Bala Rajamani ]
Paul Woods

Joined: Nov 15, 2002
Posts: 23
If I understand you correctly, you want page A1 to automatically forward itself to the new action after a set period of time? There are a few ways to do that, both on the client side. Note that niether is 100% compatible with all browsers, but you can use both in the same page - and get close.
Place in your header, which forwards to a target, index.jsp in this case, after a wait of 15 seconds.

The 2nd method is to have a javascript funtion, such as redirect() below, called from the <body> tag onLoad. Redirect just pauses a set time, and then calls another function such as go_now(), which does the forward.

Hope this helps.
Bala Raj
Ranch Hand

Joined: Sep 12, 2000
Posts: 75
Thanks for the reply Paul. But I can�t use both the solutions, because of the following reasons.
1) If I use javascript submit I loose request object, which I need to forward for the action class2.
2) My whole application is using standard header information (Meaning only one header.jsp) for the whole application.
I want to display Page A1 until I get reply from action class2.
Bhavani Giritharan

Joined: May 09, 2001
Posts: 7
If it is just to show an intermediate message, i would suggest the same page to show the intermediate message(instead of using a different jsp).
just i put the whole screen in <div> and made it visible till the submit, after the submit the rest i made invisible and put a message in the same screen. I am not sure if it works fine in netscape navigator...

Bhavani Giritharan
subject: Dynamic Submission of a page using Struts
It's not a secret anymore!