java.lang.IllegalStateException異常解決
阿新 • • 發佈:2019-02-15
最近在除錯xwiki的時候遇到java.lang.IllegalStateException異常,在google上baidu了一把
經過分析檢視jdk文件終於找到了解決方案,在response.sendRedirect("")方法後加return語句即可:
原因是在程式中兩次呼叫response.sendRedirect("")方法
j2ee5.0中的介紹:
經過分析檢視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 occursjava.lang.IllegalStateException
- If the response was committed or if a partial URL is given and cannot be converted into a valid URL