posts - 66,  comments - 40,  trackbacks - 0
          request.getParameter
          是用來接受來自get方法或post方法的參數
          <form method=post>
          <form method=get>
          <a href="1.jsp?id=1">ok</a>
          只能接受java.lang.String
          也就是說String hotel_id = request.getParameter("hotel_id");
          request.getAttribute
          是用來接受來自servlet的變量或Action(其實Action就是特殊的Servlet)
          在Action中,request.setAttribute("ret",ret);
          只能接受java.lang.Object
          也就是說List ret = (List)request.getAttribute("ret");
          如果你只用JSP,根本用不到request.getAttribute()


          getParameter得到的都是String類型的?;蛘呤莌ttp://a.jsp?id=123中的123,或者是某個表單提交過去的數據。
          getAttribute則可以是對象。
          getParameter()是獲取POST/GET傳遞的參數值;
          getAttribute()是獲取對象容器中的數據值

          request.getParameter()是接受從瀏覽器上發出的請求,返回的一定是一個String。
          request.getAttribute()一般是取從Servlet上setAttribute()的對象,返回可以是各種形式(Object)

          posted on 2006-04-20 12:01 happytian 閱讀(589) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          Welcome here, my friend!

          常用鏈接

          留言簿(12)

          隨筆檔案(66)

          文章分類

          文章檔案(63)

          web

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 89730
          • 排名 - 647

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 云龙县| 桐庐县| 房产| 桑日县| 高陵县| 襄樊市| 微博| 泰安市| 江达县| 阿瓦提县| 鹤山市| 安塞县| 阜康市| 乌海市| 晋中市| 敦化市| 灵璧县| 蚌埠市| 丹东市| 长治市| 尼玛县| 泉州市| 临猗县| 遵义县| 嵊泗县| 康乐县| 自治县| 淮安市| 甘谷县| 濮阳市| 稷山县| 彭泽县| 长寿区| 伊宁县| 灵寿县| 绩溪县| 天长市| 嵊泗县| 溧水县| 方正县| 原平市|