File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes page content type 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 » JSP
Bookmark "page content type" Watch "page content type" New topic

page content type

vinay uppala

Joined: Apr 29, 2008
Posts: 2

in my jsp I kept page content type as "application/pdf"

but inside the jsp I have used response.setContentType("images/pdf");

does this cause any problem??

I am able to get image in some browsers and not getting image in some browsers but I am unable to find what are the settings to be used so that the image has to be displayed.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Why are you setting a contentType from within a JSP?
Are you streaming PDFs from them?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
vinay uppala

Joined: Apr 29, 2008
Posts: 2
sorry that is not "images/pdf" it "is images/jpeg"
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027
If you are really trying to return a content type of ANYTHING except html or text from a JSP you are in for lots of trouble.

Binary content such as images and pdf are best handled from a servlet.

subject: page content type
It's not a secret anymore!