Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet response.setContentType()??  RSS feed

 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to set the content type to that of a jsp page in a servlet instead of a text file or an html file?
 
Raveendran Karunakaran
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

why do you want it in the JSP format ? first tell me that.

 
Mohamed Yousuff
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I dont find any use in sending the response as a jsp page. But if you still need it, try response.setContentType("text/jsp").

Originally posted by Sean Casey:
Is there a way to set the content type to that of a jsp page in a servlet instead of a text file or an html file?


------------------
 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want it in jsp format, so I can use jsp tags. "text/jsp" doesn't work, I've already tried that.
 
Mohamed Yousuff
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am sorry, I could not understand what you mean by JSP format. I think you need the file as it is to the client side. If so try "text/plain" . This will send it as it is.

Originally posted by Sean Casey:
I want it in jsp format, so I can use jsp tags. "text/jsp" doesn't work, I've already tried that.


------------------
 
Maky Chopra
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sean,
Sounds like you want a servlet to generate a jsp file with your custom tags that will run on the server and throw html content to the browser.
ContentType is for the benefit of the client.. The browser.. So that it knows how to display the incoming http stream.. Not for your server to know what it is sending.
What you are suggesting is impossible.. What is your requirement ? If you post it here, maybe we could suggest something.
 
SoonAnn Lim
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my humble opinion,sending jsp page from servlet is not such a good practice and i don't think current browser support text/jsp Mime type. If it is unavoidable situation, i suggest a intermediate html page which provide a link to the jsp page. You can display some reminder in the intermediate html page. Hope this help.
 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the responses. I'm not required to do this. I was just wondering if it could be done. There are no custom tags involved. Since a Servlet can generate a variety of page types, including gifs, and excel pages, I thought that it'sodd that it can't generate a jsp file. If it's not possible, I accept that, and I thank you all for your responses.
- Sean
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!