我的JSP有几个不同的属性,我必须在执行期间设置它们。
getFormData(request);
if(formInfo.get("Type").equals("type1"))
request.setAttribute("heading", "type1");
else
request.setAttribute("heading", "type2");
request.setAttribute("loader", "<div class=\"loader\" id=\"loading_spinner\"></div>");
request.getRequestDispatcher("").forward(request, response);
FormValidator formValidator = new FormValidator(formInfo, request, response);
if(!formValidator.validateForm())
{
request.getRequestDispatcher("").forward(request, response);
return;
}
function(); //this function has soap call and can take few minutes.
if(success) //assume success is boolean from function()
{
System.out.println("SUCCESS");
request.setAttribute("loader", "");
request.setAttribute("error_message", "<h1 class=\"header-success\"> SUCCESS</h1>");
}
现在这有两个问题。
IllegalStateException: Cannot forward after response has been committed.
我需要在当时和顺序进行更新,我已编码。