The legacy use case is indeed very important, but there are many other opportunities that can come from using Java libraries as part of Web apps.
CheerpJ provide "Library mode": an API to natively interact with Java objects from JavaScript: https://cheerpj.com/docs/guides/library-mode
CheerpJ also support Java 17 (currently in preview) and LTS parity is scheduled for next year.