How to get Outputstream
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Portal Server > How to get Outputstream




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to get Outputstream  
Robin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-30-04 04:37 PM

Hi all,

I am now using WPS 5 to develop a Portlet App, and the
customer requirement need us to create and download Excel file
with the query result from database.

Now I use the code as below:

...
workBook.output(((PortletResponse) response).getOutputStream());
...

The workBook object is the Excel object created with my query result.
But I got the IllegalStatement exception when program run this line.
Does WPS prohibit the using of response object? Thx!







[ Post a follow-up to this message ]



    Re: How to get Outputstream  
Michael Harris


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-30-04 08:33 PM

You can't output an Excel spreadsheet from inside a portlet during it's
service (doView, doHelp, etc) method processing.  Output from a portlet is
combined with other portlets and themes and skins to build up a single HTML
page to send to the browser.  You can't just dump the bytes of a spreadsheet
(or any other object such as graphics) into an HTML stream.

What you need to do is write a servlet that outputs these bytes and package
it with your portlet.  Then your portlet needs to write out a URL to the
servlet into the HTML stream that will cause the browser to invoke it and
retrieve the bytes for the spreadsheet when needed.

Remember:  A portlet's output is ALWAYS included into the middle of a bigger
HTML (or WML, or whatever markup) page... It is NEVER the entire page as it
can be in servlet programming.







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:31 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register