the process is controller(jump) -> jsp(grid) ->controller(Verification code)
so this is my code
controller(jump):
/**
* jump to login in jsp
* @return
*/
@RequestMapping("/toLogin")
public String toLogin( ) {
log.debug("to Sign In!---------------------------------------<UserinfoController>");
return "sign-in";
}
jsp(there is no tag like this "<% ... %>"):
<div class="form-group">
<label for="code">验证码</label>
<input id="code" type="text" name="code" class="span3 form-control ">
<a>
<img alt="刷新验证码" src="${pageContext.request.contextPath }/code">
</a>
</div>
controller(Verification code):
OutputStream os = resp.getOutputStream();
ImageIO.write(buffImg, "jpeg", os);
os.close();
error is :
java.lang.IllegalStateException: getWriter() has already been called for this response at org.apache.catalina.connector.Response.getOutputStream(Response.java:644) at org.apache.catalina.connector.ResponseFacade.getOutputStream(ResponseFacade.java:196) at com.wyk.pmsys.controller.CodeController.getCode(CodeController.java:107) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
in servlet jsp convert to java used "out.write()",is this confilct with my code for "resp.getOutputStream()"? that's all ,how to solve it; if something else,what's that ? and how to solve it?