I have an issue with a Cross-Site Scripting (XSS) vulnerability with my application. I have mutiple forms where the user can submit data which will be stored in database and displayed later in a jsp page. I discovered that this application isn't sufficiently protected and a user can submit malicious code which will fire an XSS attack.
I need to validate the user input from the server side after the submission of the form. Because in client side the data is displayed using a table library which will render an html content (I have no control over this library). I found a nice library in this link (https://appsec-labs.com/portal/xss-java-secure-coding/) but it concerns only the client side.
How can I do to validate these input data ? whether it is an html or a javscript code or what else.
Thanks