jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Writer already called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Writer already called" Watch "Writer already called" New topic

Writer already called

Vikas Aggarwal
Ranch Hand

Joined: Jun 22, 2001
Posts: 140

I have a jsp and a servlet. The servlet has been included in JSP. The servlet uses gzip stream to read file and send to browser. The problem is that when this JSP is called it throws witer already called exception. I understand this is because JSP has already a writer "out" which has been called and my servlet also has one.

Is there a way to get around this problem. I can not convert servlet to jsp because of security.

Thanks in advance.

Vikas Aggarwal

Founder @
Leads and Deals Limited

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Any time binary streamed data is involved, you should stear clear of JSPs. Why is the servlet accessed from a JSP - can't the servlet be accessed directly?
I agree. Here's the link: http://aspose.com/file-tools
subject: Writer already called
It's not a secret anymore!