求助!servletResponse中为什么会没有setCharacterEncoding方法?

[复制链接]
查看11 | 回复5 | 2021-1-27 05:31:42 | 显示全部楼层 |阅读模式
实现了javax.servlet下的Filter接口为什么会找不到这个方法呢



分 -->
回复

使用道具 举报

千问 | 2021-1-27 05:31:42 | 显示全部楼层



回复

使用道具 举报

千问 | 2021-1-27 05:31:42 | 显示全部楼层
有人吗




回复

使用道具 举报

千问 | 2021-1-27 05:31:42 | 显示全部楼层
版本的问题吧
回复

使用道具 举报

千问 | 2021-1-27 05:31:42 | 显示全部楼层
/**
*Setsthecharacterencoding(MIMEcharset)oftheresponse
*beingsenttotheclient,forexample,toUTF-8.
*Ifthecharacterencodinghasalreadybeensetby
*{@link#setContentType}or{@link#setLocale},
*thismethodoverridesit.
*Calling{@link#setContentType}withtheString
*oftext/htmlandcalling
*thismethodwiththeStringofUTF-8
*isequivalentwithcalling
*setContentTypewiththeStringof
*text/html;charset=UTF-8.
*Thismethodcanbecalledrepeatedlytochangethecharacter
*encoding.
*Thismethodhasnoeffectifitiscalledafter
*getWriterhasbeen
*calledoraftertheresponsehasbeencommitted.
*Containersmustcommunicatethecharacterencodingusedfor
*theservletresponse'swritertotheclientiftheprotocol
*providesawayfordoingso.InthecaseofHTTP,thecharacter
*encodingiscommunicatedaspartoftheContent-Type
*headerfortextmediatypes.Notethatthecharacterencoding
*cannotbecommunicatedviaHTTPheadersiftheservletdoesnot
*specifyacontenttype;however,itisstillusedtoencodetext
*writtenviatheservletresponse'swriter.
*
*@paramcharsetaStringspecifyingonlythecharacterset
*definedbyIANACharacterSets
*(http://www.iana.org/assignments/character-sets)
*
*@see#setContentType
*#setLocale
*
*@since2.4
*
*/
publicvoidsetCharacterEncoding(Stringcharset);

2.4以前的版本应该没有
回复

使用道具 举报

千问 | 2021-1-27 05:31:42 | 显示全部楼层
强转为HTTPServletResponse
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行