Siv*_*nam 0 java servlets this
在下面的servlet中,我想添加内容类型和字符集编码.
public class FBOAuth extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
this.response.setContentType("application/json");
this.response.setCharacterEncoding("UTF-8");
...
Run Code Online (Sandbox Code Playgroud)
我使用以下命令编译此servlet.
$ javac -classpath json.jar FBOAuth.java
Run Code Online (Sandbox Code Playgroud)
FBOAuth.java:24: error: cannot find symbol
this.response.setContentType("application/json");
^
symbol: variable response
FBOAuth.java:25: error: cannot find symbol
this.response.setCharacterEncoding("UTF-8");
^
symbol: variable response
2 errors
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
319 次 |
| 最近记录: |