第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

filter編寫后,依然報錯。沒有起作用

@SpringBootApplication
public?class?AjaxserverApplication?{

????public?static?void?main(String[]?args)?{
????????SpringApplication.run(AjaxserverApplication.class,?args);
????}

????@Bean
????public?FilterRegistrationBean?registerFilter()?{
????????FilterRegistrationBean?bean?=?new?FilterRegistrationBean();
????????bean.addUrlPatterns("/*");
????????bean.setFilter(new?CrosFilter());
????????return?bean;
????}

}
public?class?CrosFilter?implements?Filter?{
????@Override
????public?void?doFilter(ServletRequest?request,?ServletResponse?response,?FilterChain?chain)?throws?IOException,?ServletException?{
????????HttpServletResponse?res?=?(HttpServletResponse)?response;
????????res.addHeader("Access-Control-Allow-Origin",?"*");
????????res.addHeader("Access-Control-Allow-Methods",?"*");
????????chain.doFilter(request,?response);
????}
????@Override
????public?void?init(FilterConfig?filterConfig)?throws?ServletException?{}
????@Override
????public?void?destroy()?{}
}

https://img1.sycdn.imooc.com//5bf79da90001e1e103890116.jpg

但還是報錯,不知道問題出在哪里,打斷點也沒看出問題在哪里

https://img1.sycdn.imooc.com//5bf79dc90001469909500264.jpg


正在回答

2 回答

找到問題了,是頁面上。我用的ajax請求,不是老師所寫的

$.getJSON

而且沒寫明請求方式type:“get”,所以瀏覽器校驗不通過。

1 回復 有任何疑惑可以回復我~
#1

qq_軼默存_0

我看老師的代碼里也沒有寫type方式???能不能把xml代碼也貼出來。非常感謝
2019-04-21 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

filter編寫后,依然報錯。沒有起作用

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號