java.lang.IllegalStateException 예외 해결

1440 단어
java.lang.IllegalStateException 예외 해결
최근에 xwiki를 디버깅할 때java를 만났어요.lang.Illegal State Exception 이상, 구글에서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

좋은 웹페이지 즐겨찾기