writer.write(service.echo("Foo"));
}
private void doStatefulExample(ApplicationContext ctx, PrintWriter writer,
HttpSession session) {
CounterService service = (CounterService) session
.getAttribute("counterService");
if (service == null) {
try {
CounterServiceHome home = (CounterServiceHome) ctx
.getBean("counterServiceHome");
service = (CounterService) home.create();
session.setAttribute("counterService", service);
} catch (CreateException ex) {
ex.printStackTrace(writer);
return;
}
}
writer.write("Counter: " + service.increment());
}