hi I'm writing a webapplication using servelet-api 3.0.1 with the async request processing.
Basically I use spring mvc controller, and Request mapping where I return an ModelAndView as deffered result.
My controller looks as follows
@RequestMapping("/deferred-result/model-and-view")
public DeferredResult<ModelAndView> deferredResultWithView() {
final DeferredResult<ModelAndView> result = new DeferredResult<ModelAndView>();
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Hello world");
result.setResult(new ModelAndView("views/html", "javaBean", new JavaBean("bar", "apple")));
}
}).start();
return result;
}
My JSP looks as follows
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
<title>My HTML View</title>
<link href="<c:url value="/resources/form.css" />" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="success">
<h3>foo: "${javaBean.foo}"</h3>
<h3>fruit: "${javaBean.fruit}"</h3>
</div>
</body>
</html>
I have narrow down the problem as follows, when I return ModelAndView synchronously (that means without DefferedResult) Jsp content is loading perfectly as I expected.
I'm getting following log in my tomcat log. And the content of the page is not loading. Instead I'm getting an empty page.
Sep 29, 2013 3:09:03 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.