You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Zsolt Koppany <zk...@web.de> on 2002/09/04 08:57:22 UTC

How to get Excel directly started using response.setContentType(...) from JSP?

Hi,

I can get Excel directly started from a servlet using two things:
1. response.setContentType("application/vnd.ms-excel");
2. the servlet path ends with result.xls (like /servlet/abc/result.xls?p=1)

I can use response.setContentType(...) from JSP too, but I was not able to use 
a JSP path to end with "xls", thus when I start (click on a link) the JSP 
file, first I'm asked whether I want to open the file directly or just to 
download.
How could I get Excel started without any furher questions like it is possible 
from a servlet?

Zsolt

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to get Excel directly started using response.setContentType(...) from JSP?

Posted by Zsolt Koppany <zk...@web.de>.
No, it didn't help.

Zsolt

On Thursday 05 September 2002 01:56, Justin Ruthenbeck wrote:
> Have you tried Randy Paries' suggestion about appending a bogus parameter
> like this:
>
> http://www.host.com/myApp/account/users/results.jsp?a=.xls
>
> I've seen this work for jpg and swf files before -- curious if this will
> solve your problem...
>
> justin
>
> At 04:19 PM 9/4/2002, you wrote:
> >I do use setContentType(), but I do get asked by IE whether I want to open
> > or save the document. From a servlet using the ...xls in the URL I can
> > prevent the question whether I want to open the document, it will be
> > opened without any questions.
> >
> >Zsolt
> >
> >On Wednesday 04 September 2002 20:46, Justin Ruthenbeck wrote:
> > > Zsolt --
> > >
> > > Guess I'm a bit confused why you wouldn't want to use the
> > > setContentType() method in your jsp ... this is how a problem like this
> > > is normally solved (and why the method exists in the first place).
> > >
> > > Regardless, you can also do it by extension on your jsp.  Depending on
> > > how your project is setup, this may be prohibitively difficult, but you
> > > can precompile your jsp and map it (now a servlet) to whatever you want
> > > in your web.xml -- map it to result.xls if you'd like.  If you (1)
> > > aren't precompiling jsps or (2) have a complex proxy environment with
> > > webservers, this will be difficult.  All the more reason to use
> > > setContentType().
> > >
> > > Happy trails!
> > > justin
> > >
> > > At 11:57 PM 9/3/2002, you wrote:
> > > >Hi,
> > > >
> > > >I can get Excel directly started from a servlet using two things:
> > > >1. response.setContentType("application/vnd.ms-excel");
> > > >2. the servlet path ends with result.xls (like
> > > > /servlet/abc/result.xls?p=1)
> > > >
> > > >I can use response.setContentType(...) from JSP too, but I was not
> > > > able to use
> > > >a JSP path to end with "xls", thus when I start (click on a link) the
> > > > JSP file, first I'm asked whether I want to open the file directly or
> > > > just to download.
> > > >How could I get Excel started without any furher questions like it is
> > > >possible
> > > >from a servlet?
> > > >
> > > >Zsolt
> > > >
> > > >--
> > > >To unsubscribe, e-mail:
> > > > <ma...@jakarta.apache.org> For additional
> > > > commands, e-mail: <ma...@jakarta.apache.org>
> >
> >--
> >To unsubscribe, e-mail:  
> > <ma...@jakarta.apache.org> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to get Excel directly started using response.setContentType(...) from JSP?

Posted by Justin Ruthenbeck <ju...@nextengine.com>.
Have you tried Randy Paries' suggestion about appending a bogus parameter 
like this:

http://www.host.com/myApp/account/users/results.jsp?a=.xls

I've seen this work for jpg and swf files before -- curious if this will 
solve your problem...

justin


At 04:19 PM 9/4/2002, you wrote:
>I do use setContentType(), but I do get asked by IE whether I want to open or
>save the document. From a servlet using the ...xls in the URL I can prevent
>the question whether I want to open the document, it will be opened without
>any questions.
>
>Zsolt
>
>On Wednesday 04 September 2002 20:46, Justin Ruthenbeck wrote:
> > Zsolt --
> >
> > Guess I'm a bit confused why you wouldn't want to use the setContentType()
> > method in your jsp ... this is how a problem like this is normally solved
> > (and why the method exists in the first place).
> >
> > Regardless, you can also do it by extension on your jsp.  Depending on how
> > your project is setup, this may be prohibitively difficult, but you can
> > precompile your jsp and map it (now a servlet) to whatever you want in your
> > web.xml -- map it to result.xls if you'd like.  If you (1) aren't
> > precompiling jsps or (2) have a complex proxy environment with webservers,
> > this will be difficult.  All the more reason to use setContentType().
> >
> > Happy trails!
> > justin
> >
> > At 11:57 PM 9/3/2002, you wrote:
> > >Hi,
> > >
> > >I can get Excel directly started from a servlet using two things:
> > >1. response.setContentType("application/vnd.ms-excel");
> > >2. the servlet path ends with result.xls (like
> > > /servlet/abc/result.xls?p=1)
> > >
> > >I can use response.setContentType(...) from JSP too, but I was not able to
> > >use
> > >a JSP path to end with "xls", thus when I start (click on a link) the JSP
> > >file, first I'm asked whether I want to open the file directly or just to
> > >download.
> > >How could I get Excel started without any furher questions like it is
> > >possible
> > >from a servlet?
> > >
> > >Zsolt
> > >
> > >--
> > >To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org> For additional
> > > commands, e-mail: <ma...@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to get Excel directly started using response.setContentType(...) from JSP?

Posted by Zsolt Koppany <zk...@web.de>.
I do use setContentType(), but I do get asked by IE whether I want to open or 
save the document. From a servlet using the ...xls in the URL I can prevent 
the question whether I want to open the document, it will be opened without 
any questions.

Zsolt

On Wednesday 04 September 2002 20:46, Justin Ruthenbeck wrote:
> Zsolt --
>
> Guess I'm a bit confused why you wouldn't want to use the setContentType()
> method in your jsp ... this is how a problem like this is normally solved
> (and why the method exists in the first place).
>
> Regardless, you can also do it by extension on your jsp.  Depending on how
> your project is setup, this may be prohibitively difficult, but you can
> precompile your jsp and map it (now a servlet) to whatever you want in your
> web.xml -- map it to result.xls if you'd like.  If you (1) aren't
> precompiling jsps or (2) have a complex proxy environment with webservers,
> this will be difficult.  All the more reason to use setContentType().
>
> Happy trails!
> justin
>
> At 11:57 PM 9/3/2002, you wrote:
> >Hi,
> >
> >I can get Excel directly started from a servlet using two things:
> >1. response.setContentType("application/vnd.ms-excel");
> >2. the servlet path ends with result.xls (like
> > /servlet/abc/result.xls?p=1)
> >
> >I can use response.setContentType(...) from JSP too, but I was not able to
> >use
> >a JSP path to end with "xls", thus when I start (click on a link) the JSP
> >file, first I'm asked whether I want to open the file directly or just to
> >download.
> >How could I get Excel started without any furher questions like it is
> >possible
> >from a servlet?
> >
> >Zsolt
> >
> >--
> >To unsubscribe, e-mail:  
> > <ma...@jakarta.apache.org> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to get Excel directly started using response.setContentType(...) from JSP?

Posted by Randy Paries <ra...@unitnet.com>.
The only problem with using setContentType is a wonderful bug in IE
Not sure if it is for excel but we are having the problem with pdf's
The work around is to but a dummy name/value in the query string 
Foo=.pdf

RP

-----Original Message-----
From: Justin Ruthenbeck [mailto:justinr@nextengine.com] 
Sent: Wednesday, September 04, 2002 1:47 PM
To: Tomcat Users List
Subject: Re: How to get Excel directly started using
response.setContentType(...) from JSP?



Zsolt --

Guess I'm a bit confused why you wouldn't want to use the
setContentType() 
method in your jsp ... this is how a problem like this is normally
solved 
(and why the method exists in the first place).

Regardless, you can also do it by extension on your jsp.  Depending on
how 
your project is setup, this may be prohibitively difficult, but you can 
precompile your jsp and map it (now a servlet) to whatever you want in
your 
web.xml -- map it to result.xls if you'd like.  If you (1) aren't 
precompiling jsps or (2) have a complex proxy environment with
webservers, 
this will be difficult.  All the more reason to use setContentType().

Happy trails!
justin

At 11:57 PM 9/3/2002, you wrote:
>Hi,
>
>I can get Excel directly started from a servlet using two things: 1. 
>response.setContentType("application/vnd.ms-excel");
>2. the servlet path ends with result.xls (like 
>/servlet/abc/result.xls?p=1)
>
>I can use response.setContentType(...) from JSP too, but I was not able

>to
>use
>a JSP path to end with "xls", thus when I start (click on a link) the
JSP
>file, first I'm asked whether I want to open the file directly or just
to
>download.
>How could I get Excel started without any furher questions like it is 
>possible
>from a servlet?
>
>Zsolt
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail: 
><ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.384 / Virus Database: 216 - Release Date: 8/21/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.384 / Virus Database: 216 - Release Date: 8/21/2002
 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to get Excel directly started using response.setContentType(...) from JSP?

Posted by Justin Ruthenbeck <ju...@nextengine.com>.
Zsolt --

Guess I'm a bit confused why you wouldn't want to use the setContentType() 
method in your jsp ... this is how a problem like this is normally solved 
(and why the method exists in the first place).

Regardless, you can also do it by extension on your jsp.  Depending on how 
your project is setup, this may be prohibitively difficult, but you can 
precompile your jsp and map it (now a servlet) to whatever you want in your 
web.xml -- map it to result.xls if you'd like.  If you (1) aren't 
precompiling jsps or (2) have a complex proxy environment with webservers, 
this will be difficult.  All the more reason to use setContentType().

Happy trails!
justin

At 11:57 PM 9/3/2002, you wrote:
>Hi,
>
>I can get Excel directly started from a servlet using two things:
>1. response.setContentType("application/vnd.ms-excel");
>2. the servlet path ends with result.xls (like /servlet/abc/result.xls?p=1)
>
>I can use response.setContentType(...) from JSP too, but I was not able to 
>use
>a JSP path to end with "xls", thus when I start (click on a link) the JSP
>file, first I'm asked whether I want to open the file directly or just to
>download.
>How could I get Excel started without any furher questions like it is 
>possible
>from a servlet?
>
>Zsolt
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>