I am starting my long and bumpy road to move website from shit i made 20 years ago to Jakarta ee backend, mysql and html javascript frontend. Have some success with java, but problems in javascript.
In my JSP I have javascript function to make thumbnails (chatgpt helped me):
// Generate thumbnails and add click event listeners
imageData.forEach((data, index) => {
const thumbnail = document.createElement('div');
thumbnail.classList.add('thumbnail');
thumbnail.innerHTML = `<img src="${data.url}" alt="Thumbnail ${index + 1}">`;
thumbnail.addEventListener('click', () => displayImage(index));
galleryContainer.appendChild(thumbnail);
});
Localy it works fine, but when it comes back from tomcat fifth line is truncated:
// Generate thumbnails and add click event listeners
imageData.forEach((data, index) => {
const thumbnail = document.createElement('div');
thumbnail.classList.add('thumbnail');
thumbnail.innerHTML = `<img src="" alt="Thumbnail 1">`;
thumbnail.addEventListener('click', () => displayImage(index));
galleryContainer.appendChild(thumbnail);
});
what could be wrong and how to avoid it?
I expected that jsp content would be the same, only with added image list (which works fine).