Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:06:47+00:00 2026-05-26T10:06:47+00:00

In this link it says:Handles the user’s request to generate the HTML for the

  • 0

In this link it says:Handles the user’s request to generate the HTML for the report and writes the HTML directly to the response object.
Now in my code, I have:

PrintWriter out = response.getWriter();
crystalReportViewer.processHttpRequest(request, response, context,null);

If I understand correctly, the processHttpRequest will itself do something like response.getWriter().print(.....).

So is the code creating 2 instances of PrintWriter?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:06:48+00:00Added an answer on May 26, 2026 at 10:06 am

    Response object will return the same writer every time. You can use these writers interchangeably:

    final PrintWriter writerA = response.getWriter();
    final PrintWriter writerB = response.getWriter();
    writerA.println("A1");
    writerB.println("B1");
    writerA.println("A2");
    writerB.println("B2");
    

    The output is as expected because writerA and writerB are actually pointing to the exact same instance of PrintWriter.

    I don’t know whether it is stated as such in the specification, the Javadoc only says:

    Either this method or getOutputStream() may be called to write the body, not both.

    That being said your code is not safe for two reasons:

    • crystalReportViewer might call response.getOutputStream() which breaks the contract quoted above

    • if you print something first and then pass the response to the crystalReportViewer chances are your output will break the crystalReportViewer output as it will be prepended.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This link: http://doc.trolltech.com/4.5/moc.html#moc says The moc tool reads a C++ header file. If it
This link says that Spring MVC is essentially a request dispatcher framework, with a
i'm checking this link: http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html It says that in order tu ouse C2DM, you
In this link: http://css-tricks.com/snippets/jquery/jquery-plugin-template/ it has a line of code that says // Add
I updated my post. Now it says link is not defined thisLink[link].scopeObject = new
This link says that Android support Python, Lua and BeanShell Scripts, subsequently for Perl
this link indicates that it is ctrl+cmd+up or down just like xcode says but
This link says that it is indeed possible to write code in Python and
Send JS object to JSP page I followed this link and found that one
In this link it says it does: http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/MultimediaPG/UsingAudio/UsingAudio.html However I have searched for an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.