Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

Send/Receive HTTP from Action

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basic Project Flow:
1. User selects a report name (reportList.jsp)

2. ReportListAction then populates the ReportListForm with the appropriate parameters to be selected (optional) or filled out (mandatory)

3. reportList.jsp is redisplayed (tiles configuration)with a new visible section for the user to enter parameter choices, user submits

4. ReportListAction recognizes the submittal and is suppose to do the following:

-> create an URL to submit to the Crystal Reports Server
-> submit URL
-> receive report response(suppose to be in HTML)
-> pass response through to a NEW browser window for viewing

PROBLEM STATEMENT:
How do I, internal to the ReportListAction, submit the URL? What general order do I need to follow? For example, do I create a HTTPClient and have that handle the request submittal and receive the response? Or should I use HttpURLConnection? I have looked over the APIs (HTTPRequest, HTTPClient, HTTPServletRequest, HTTPSession, etc.) but am not familiar enough with HTTP to know which to try first. This is my first time attempting to use HTTP.

ENVIRONMENT:
Developing in RAD, J2EE.

DISCLAIMER:
I was unsure as to which forum to initially post (I/O, Java Advanced, Struts) as the problem seems to touch all areas. Please accept my apology if I posted incorrectly.

Thanks for your input and advice!

JD
 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thomson

See you should use the URLConnection to connect to your server and get the response. But you must be sure of how to communicate to the Crystal reports . As far as i know its not HTTP thus there is no ? of using HTTPURLConnection.

Its just the same as connecting from Simple java program , but here you can get the outputStream from crystal reports in to the ServletOutputStream of the response.

hope you got what i said

Regards
Sreenath
 
JD Thompson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sreenath!!

Thank you very much for your reply. I will look into the URLConnection class and see how that works.

I believe I understood your advice in that I really don't have to worry about HTTP. Instead, just a straight URL with parameters.

I think I also understood that once I receive the response, use a ServletOutletStream to send to a new browser window.

Again, thank very much for taking time to help!!

Best regards!

JD
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We do something similar, except with an IBI server, rather than Crystal reports.

Here's what I'd recommend:

1- In the reportList.jsp, specify target="_blank" in the <html:form> tag. This will ensure that the output is sent to a new window.

2- In ReportListAction, code the following:



That's it. The request will be passed on to the Crystal Reports URL and the response will be passed back to the browser in a new window. It doesn't have to be any more complicated than this.
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic