This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with setContentType() method

 
Rajan Venkat
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want my servlet to serve the client with "text/html" type and "application/jar" type , I mean adding
response.setContentType("text/html")
response.setContentType("application/jar") both in the servlet.I know its not possible but how can i acheive this by serving both type in a single servlet.
please let me know.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There can be only one contentType per response.
What are you trying to achieve ?
 
Rajan Venkat
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a HTML page which needs to give login information and option to select to download JAR.



Servlet file :



After running this in Tomcat 4.1 ..getting error 500.
Can you tell me is there any other way to get both type information ( TEXT + JAR) in a single request.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't do that in a single request.
 
Clifton Eaton
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a way to accomplish what you want, but you need javascript for it. You basically have to cause a new window to open with a url to a servlet that will send the file with the correct headers for an "attachment" download.

jsp:
------------------------------------


Servlet:
--------------------------------


web.xml
----------------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic