最近在调试xwiki的时候遇到java.lang.illegalstateexception异常,在google上baidu了一把
经过分析查看jdk文档终于找到了凯发天生赢家一触即发官网的解决方案,在response.sendredirect("")方法后加return语句即可:
原因是在程序中两次调用response.sendredirect("")方法
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