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 阅读(8068) 评论(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

只有注册用户登录后才能发表评论。


网站导航: