aspose file tools*
The moose likes Struts and the fly likes Struts Forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Forward" Watch "Struts Forward" New topic
Author

Struts Forward

Praveen Reddy
Ranch Hand

Joined: Jul 12, 2006
Posts: 51
I've got a case where i will get Dynamic html response in my struts action i need to embed this response to a existing popup dialog.

instead of forwarding a success page i need to forward this response (Dynamically generated) can any one please tell me how can i forward this response.

i can only use Struts 2 (i cant use Servlets).



Thanks
Praveen
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
What does the response contain? What do you want the response to generate?
[ June 19, 2008: Message edited by: James Clark ]
Praveen Reddy
Ranch Hand

Joined: Jul 12, 2006
Posts: 51
my response contains html content which is dynamically generated this response i need to send to existing popup dialog.



this response i need to forward to the ajax call from struts
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Thanks. One more question, where is the request coming from? Or, in other words, what is calling the Struts action?

Is the call coming from Javascript which is nested in a HTML page?

Is the Javascript calling the Struts action by making a call using a URL?
[ June 20, 2008: Message edited by: James Clark ]
Praveen Reddy
Ranch Hand

Joined: Jul 12, 2006
Posts: 51
Flow is here

1) from my JSP page when i click on a link a java script method is called, In this method a ajax request to struts action ( this Ajax call handles Success and Failure cases and catches the response text)

2) My struts action performs
a) A call to eclipse BIRT Engine which access a report "test.rptdesign" and as a response it sends HTML Content

Below code is responsible to run and render the report



This Code is responsible to create a HTML File with the response from above code


I can create a HTML page but instead of creating a page i need to send this HTML response directly to my ajax call



In struts i need to return this response to the Ajax call.

Please let me know if you have any questions i need to solve this problem this is very important to me.

Thanks
Praveen
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
1. You have an HTML page

2. On this HTML page you have a Javascript-based link

3. When a user clicks on this link, a Struts action is called

4. The Struts action is coded to open a report and extract HTML from the report

5. You want to send this HTML as a response to the Ajax call (from the Javascript link above)


Is the above correct?

P.S. It is unclear if you know this, but, when using Ajax, data is retrieved using an instance of XMLHttpRequest. In other words, you shouldn't be calling a Struts action. Also, why are you going to a report for data instead of the actual database?
[ June 20, 2008: Message edited by: James Clark ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Forward