473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

HttpServletResponse.setCharacterEncoding - cannot resolve symbol

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
final.

Thanks for your help!

Tim

Test Code:
/**************************

import java.io.*;
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.
*/
request.setCharacterEncoding("utf-8");
/*
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:
TestCharSet.java [15:1] cannot resolve symbol
symbol : method setCharacterEncoding (java.lang.String)
location: interface javax.servlet.http.HttpServletResponse
response.setCharacterEncoding("utf-8");
*/
response.setCharacterEncoding("utf-8");

}
}
Jul 17 '05 #1
1 27726
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Naresh Agarwal | last post by:
Hi I want HTTPServletResponse to *close* the socket after sending the response. For this I'm closing the OutputStream after writing the data. But still socket is not closed and client keeps on...
1
by: yanwan | last post by:
I met this problem in executing a c++ project in visual studio. Does anyone have suggestions to resolve "error lnk 2001"? --------------------Configuration: reconstruction - Win32...
1
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
1
by: vsp15584 | last post by:
Hii..i use the coding as below :- import java.applet.applet; import java.awt.*; import com.sun.j3d.utils.applet.mainframe; import com.sun.j3d.utils.universe.*; import...
3
by: toish | last post by:
I have a program, aaa.java which creates an instance of another class(bbb.java). both java files are in a package entitled 'diss' bbb.java compiles sucessfully aaa.java throws a cannot resolve...
3
by: adamrace | last post by:
Hi, i am fairly new to java and have been stuck on this for ages, basically i need to create a new object which gets a list of data from a text file, so i have this import java.io.*; ...
15
by: Seral1969 | last post by:
Hi, I'm new to Java... I've been trying to get one of my professor's examples to work... He says that the code is fine, but I keep getting 4 "cannot resolve symbol" errors when I try to compile...
7
by: Spectrum | last post by:
I am writing some Python code using the Message Passing Interface (MPI), an API used in parallel computing. There exist a number of Python implementations of MPI, but apparently they all rely on...
3
by: Sindhu Rani | last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do??? C:\s\source>javac -d ..\classes devtestdrive.java devtestdrive.java:5: cannot resolve symbol...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.