1. 程式人生 > >JavaWeb學習中的小問題

JavaWeb學習中的小問題

style 其他 body request對象 resp 深入 原來 tro 字符串

1. HttpServletRequest和ServletReque之間的區別?

再看別人項目的時候突然看到一句:

ServletRequest request;
HttpServletRequest hsRequest = (HttpServletRequest) request;// 獲取HttpServletRequest對象

  瞬間就有一點懵逼 ,趕緊查了一下,原來是爸爸和兒子的關系。。。爸爸(ServletRequest)很牛逼,適用的請求很廣泛,兒子(HttpServletRequest)稍遜一丟丟,只能獲取Http協議的請求。

  深入理解ServletRequest與ServletResponse:http://blog.51cto.com/lavasoft/275586

  get和post的區別:http://blog.163.com/llf_046/blog/static/527371192009224022140/

2.X-Requested-With 這個Http請求頭有什麽作用?

  可以判斷客戶端來的請求是Ajax請求還是其他請求。

3.java中的equalsIgnoreCase的作用?

  public boolean equalsIgnoreCase(String anotherString)將此String與另一個String進行比較,不考慮大小寫。如果兩個字符串中對應字符都相等且長度都相等,則認為這兩個字符串是相等的,並返回true。

 

JavaWeb學習中的小問題