This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes response.setContentType() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "response.setContentType()" Watch "response.setContentType()" New topic
Author

response.setContentType()

Aggarwal Arpit
Ranch Hand

Joined: Mar 04, 2012
Posts: 86
Hi,

I am having a String str


I am writing to response and fetching in Ajax call


Now the question is, I am getting String but some extra string is appending to it like


to responseObject, don't know why, even i removed
context.getResponse().setContentType("text/html;charset=UTF-8");

Please help me to solve this issue.

Thanks In Advance!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

It has nothing at all to do with the content type. Somehow, that text is getting inserted by your code into the response buffer. Inspect your code to see why.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Aggarwal Arpit
Ranch Hand

Joined: Mar 04, 2012
Posts: 86
thanks Bear for reply, but it is the last line of my code, so how can code be instered in response buffer
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

Without seeing any of your code, who can say?

Please post the relevant parts of the code, being sure to UseCodeTags.
 
wood burning stoves
 
subject: response.setContentType()
 
Similar Threads
Assign Jsp variable to Javascript variable
Need to perform an insert operation with AJAX
Reflection
Conversion of special characters in a SOAP WebService Client
Getting SOAPMessage as null