By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,032 Members | 825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,032 IT Pros & Developers. It's quick & easy.

HttpServletResponse.setCharacterEncoding - cannot resolve symbol

P: n/a
I am investigating a solution to build all pages sent from my
application servlet in UTF-8 encoding. From what I understand, I
should be using HttpServletResponse.setCharacterEncoding("UTF-8"). The
J2EE API clearly shows that this method is available with superclass
ServletResponse but I am getting compile errors using NetBeans 3.6

Thanks for your help!


Test Code:

import java.text.*;
import java.util.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestCharSet extends HttpServlet{
public void doGet
(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html; charset=UTF-8");
This works but don't understand what it would do?
Docs say:
Overrides the name of the character encoding
used in the body of this request.
This is what I really want to do.
I wish to set the encoding of the responded document
Docs say:
Sets the character encoding (MIME charset) of the response
being sent to the client, for example, to UTF-8.
This one sounds correct but I get the error: [15:1] cannot resolve symbol
symbol : method setCharacterEncoding (java.lang.String)
location: interface javax.servlet.http.HttpServletResponse

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I believe this is a bug with NetBeans. setCharacterEncoding is only
available in servlet 2.4 and I think that for some reason, NetBeans is
looking at two different servlet*.jar files. This would explain why NB
shows the method on the object but does not compile.

I believe I need to find a different solution.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.