异步部件JSP的foreach(Java EE应用程序) [英] asynchronous widget JSP foreach (Java EE application)

查看:160
本文介绍了异步部件JSP的foreach(Java EE应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSP页面下面的code:

I have the following code in a JSP page:

<c:forEach var="widget" items="${widgets}">
        <p><h2>Widget</h2></p>
        <p>IDType: ${widget.id}</p>
        <p>Name: ${widget.name}</p>  
</c:forEach>

目前,它仅仅是将要显示的文本,但在未来将会有图表和影像。
我想用异步加载的,所以页没有等待的最大图像/图表。
在互联网上,我发现了Java的code教程,但不是JSP页面。什么是落实在JSP页面异步加载的最佳方式?

At the moment it is only text that will be displayed, but in the future there will be charts and images as well. I would like to use asynchronous loading, so the page doesn't have to wait on the largest images/charts. On the internet I found tutorials for Java code, but not for JSP pages. What is the best way to implement asynchronous loading in JSP pages?

谢谢!

推荐答案

只需使用单独的servlet不同产生这些图片和图表:

Simply generate these images and charts separately using different servlet:

<c:forEach var="widget" items="${widgets}">
    <p><h2>Widget</h2></p>
    <p>IDType: ${widget.id}</p>
    <p>Name: ${widget.name}</p>  
    <img src="chart-servlet.png?id=${widget.id}"/>
    <img src="image-servlet.png?id=${widget.id}"/>
</c:forEach>

在服务器端映射中的某些servlet来排行榜servlet.png 图像servlet.png 。然后,您可以使用 ID 参数,生成相应的图表或图像。从浏览器的角度来看,首先呈现DOM没有图像,然后要求对外部资源(图片)服务器。

On the server side map some servlets to chart-servlet.png and image-servlet.png. You can then use id parameter to generate appropriate chart or image. From the browser perspective it first renders DOM without images to then ask server for external resources (images).

这篇关于异步部件JSP的foreach(Java EE应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆