SunQuest
           Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old August 29th, 2002, 11:13 AM
sgaucho sgaucho is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 26 sgaucho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 28 sec
Reputation Power: 0
Exclamation response.write

Hi,

I hv the fwg code that reads a blob from an Oracle db and outputs it.. the prob is that the output is shown in the same browser window or in some cases opens abruptly in another application (in my case it opened in Homesite!!)...

Is there any way I can force the output to appear in a new browser window like a pop up??

PHP Code:
 response.setContentType(contype);
    
// response.setHeader("Content-Disposition", "attachment; filename=\"" + doccode + excel +"\"");
      
long index 1;

      while(
index doc.length()){
      
response.getOutputStream().write(doc.getBytes(index,100));
       
index+=100;

     } 


Note, I am not setting the header as I dont want an save/open dialog box...

Oh yes, one more thing.. sometimes on certain blobs, i get this error "java.lang.IllegalStateException: getOutputStream() has already been called for this response"
Why does this happens??

any suggestions??

thnx,
sgaucho

Reply With Quote
  #2  
Old August 31st, 2002, 03:58 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Well, as for setting the header, if you don't set a content type the browser is going to assume text/html. You probably don't want that if you're sending back an xls file.

As for a popup window, the best way would be to create the popup window *first*, and point it at your code.

The odd window behavior is probably related to the content type not being text/html.

As for the error, your while loop should look like
Code:
OutputStream out = response.getOutputStream();

while(index < doc.length()) {
  out.write(doc.getBytes(index,100));
  index+=100;
}

Reply With Quote
  #3  
Old September 2nd, 2002, 09:54 AM
sgaucho sgaucho is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 26 sgaucho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 28 sec
Reputation Power: 0
Hi,

I changed my code as per ur suggestion, but continue to get the "java.lang.IllegalStateException: getOutputStream() has already been called for this response" Error...

AGain, this happens only on a few types of blobs.. whats strange is I hv 4 types of blobs.. word, an xls file, 1 text and 2 images... the code runs fine for all except for 1 image where it throws the above exception..

any more suggestions??

thnx again,
sands

Reply With Quote
  #4  
Old September 2nd, 2002, 10:18 AM
sgaucho sgaucho is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 26 sgaucho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 28 sec
Reputation Power: 0
solved it.. closed the outputStream and the problem disappeared...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > response.write


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway