代码如下:
@At("/async")
public void async(final HttpServletRequest req, final HttpServletResponse resp, ActionContext ac) {
//我有一段耗时较长的逻辑,需要在别的线程中执行,执行完毕后,返回一个视图(html 或者 jsp),但是下面这种做法不行
new Thread(new Runnable() {
@Override
public void run() {
ForwardView view = new ForwardView("/async.html");
try {
view.render(req, resp, null);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
请问,我该怎么实现?