M
M
multiscripter2018-05-30 11:34:17
Java
multiscripter, 2018-05-30 11:34:17

How to display pictures in elements added dynamically?

Hello.
There is a Java EE web application of the Hello, world level. Deployed on Tomcat 8. The main page displays a list of items. Each element contains text and pictures.
If you add a new element with pictures in the application admin panel, and then go to the main page, then this element is displayed, but without pictures. http status: 404. The Chome inspector shows that the file type is text/html although the extension is .jpg.
After restarting Tomcat, the pictures of the added element are displayed.
When creating an element in the admin panel, a folder is created inside the folder with the application, where all the images related to the element are added.
As I understand it, you need to clear some kind of cache or update the data in memory so that Tomcat knows that the new element has pictures and where to get them from.
But I don't know what to do for this. Help me please. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2018-05-30
@sergey-gornostaev

It is necessary to check what url the image in the new element has, whether it is the correct url, whether there is a corresponding image file in the directory to which this url is displayed, check what http status the server gives when trying to open the image by this url and what is written in this moment server logs. Only by adding all this information to the question is there a chance of getting an answer. This chance increases even more if you add code and configuration.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question