Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Forward

 
Praveen Reddy
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic