简体   繁体   English

显示来自 Web 目录的图像列表的 Java jsp/servlet 示例

[英]Java jsp/servlet example to display list of image from web directory

I'm newbie in Java web development.我是 Java Web 开发的新手。 Currently I'm writing a web page to display list of images stored in web directory using jsp/servlet.目前我正在编写一个网页来使用 jsp/servlet 显示存储在 web 目录中的图像列表。 I want my page to display list of images in grid view (similar when we search image in google image function, results is displayed in grid view to user).我希望我的页面在网格视图中显示图像列表(类似于我们在谷歌图像功能中搜索图像时,结果以网格视图显示给用户)。

I tried to find some resources from internet to get ideal how to do it in java.我试图从互联网上找到一些资源,以获得理想的如何在 Java 中做到这一点。 But I'm still not yet found it.但我还没有找到。

Anyone who know any good examples about how to do it, please help in terms of任何知道如何做的好例子的人,请帮助

  1. Example links or solution material示例链接或解决方案材料
  2. Possible approach / steps of how should I approach the problem我应该如何解决问题的可能方法/步骤

When you approach a problem try to break down the steps当您解决问题时,请尝试分解步骤

  1. Retrieving the list of images检索图像列表

    a.一种。 Do you wish to write the code for storing the images or will you only need to fetch them您是要编写用于存储图像的代码还是只需要获取它们

    b.For displaying First you need to get the data in your controller and the display it on the view为了显示首先您需要在控制器中获取数据并将其显示在视图上

Can add more details to the analysis mentioned above可以在上面提到的分析中添加更多细节

Update#1 Before going for a list can you try to simply fetch an image from the database (although in case of no of images in the list plenty of things have to be considered but we will deal with it later on ).更新#1 在查找列表之前,您可以尝试简单地从数据库中获取图像(尽管如果列表中没有图像,则必须考虑很多事情,但我们稍后会处理它)。

Now approach is现在的做法是

  1. Fetching an image from the database从数据库中获取图像
  2. Getting it to your controller将其发送到您的控制器
  3. Displaying the fetched image to the view将获取的图像显示到视图中

Can you add some analysis to the mentioned steps.您能否在上述步骤中添加一些分析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM