Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSP parallel include

One thing I like about JSP is include mechanism. In JSP I can simply write:

<jsp:include page='/widget/foo-widget?param=value' />

It works very well when I have some sort of widget and I want incude it on some other page.

The other day I think, It would be nice if include doesn't block thread control, so if I have several includes, they could be processed in parallel. Is there any way to do it in JSP?

like image 223
Denis Bazhenov Avatar asked Apr 28 '26 04:04

Denis Bazhenov


1 Answers

No, there isn't and it is also not worth the effort. HTML response is to be streamed sequentially anyway.

If you're actually doing expensive business stuff to preprocess one and other, then you should already not be using JSP for that, but a Servlet where you've the freedom to spawn threads. This still ought to be done carefully, you don't want to leak threads or to have deadlocks. The java.util.concurrent API may be helpful in this.

like image 155
BalusC Avatar answered Apr 29 '26 18:04

BalusC