David.Ko

          Follow my heart!
          posts - 100, comments - 11, trackbacks - 0, articles - 0
             :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          java.lang.IllegalStateException

          Posted on 2007-04-30 18:23 David.Ko 閱讀(8092) 評論(4)  編輯  收藏 所屬分類: j2se
          最近做的在response.sendRedirect()時出現下列錯誤:
          java.lang.IllegalStateException
           org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:423)

          經過搜索找到解決的辦法:



          j2ee5.0中的介紹:

          sendRedirect

          void sendRedirect(java.lang.String location)
          throws java.io.IOException
          Sends a temporary redirect response to the client using the specified redirect location URL. This method can accept relative URLs; the servlet container must convert the relative URL to an absolute URL before sending the response to the client. If the location is relative without a leading '/' the container interprets it as relative to the current request URI. If the location is relative with a leading '/' the container interprets it as relative to the servlet container root.

          If the response has already been committed, this method throws an IllegalStateException. After using this method, the response should be considered to be committed and should not be written to.

           

          Parameters:
          location - the redirect location URL
          Throws:
          java.io.IOException - If an input or output exception occurs
          java.lang.IllegalStateException - If the response was committed or if a partial URL is given and cannot be converted into a valid URL


          此類的樹結構:http://www.leftworld.net/online/j2sedoc/javaref/java.lang.illegalstateexception_dsc.htm

          評論

          # re: java.lang.IllegalStateException  回復  更多評論   

          2007-07-17 19:03 by sdf
          不能同時有兩次的response.sendRedirect();

          # re: java.lang.IllegalStateException  回復  更多評論   

          2007-08-22 19:07 by sdu
          很不錯喲....謝謝

          # re: java.lang.IllegalStateException  回復  更多評論   

          2007-12-19 16:15 by fireox
          Thank you very much.

          # re: java.lang.IllegalStateException  回復  更多評論   

          2008-08-12 22:52 by freeit
          thanks

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


          網站導航:
           
          主站蜘蛛池模板: 西乌珠穆沁旗| 大庆市| 自治县| 阳山县| 灌阳县| 区。| 远安县| 达孜县| 明水县| 东安县| 隆回县| 蓬安县| 德江县| 甘德县| 台南市| 仙游县| 天门市| 应城市| 德清县| 常州市| 吕梁市| 泾阳县| 巴南区| 尤溪县| 林甸县| 紫阳县| 广安市| 大埔县| 东乌珠穆沁旗| 南和县| 麻江县| 泽州县| 濉溪县| 拉萨市| 连城县| 韶关市| 内江市| 堆龙德庆县| 灵石县| 珲春市| 婺源县|