• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Forward

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
What are your superhero powers? Go ahead and try them on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic