Using MicroProfile Config to Render Web Components on the Server with JSP

To inject dynamic content to *.js files on the server side, the JSP's (Jakarta Server Pages) file extension has to be configured in web.xml:

<?xml version="1.0" encoding="UTF-8"?>

Now a String array exposed from a CDI bean:

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.microprofile.config.inject.ConfigProperty;

public class Developer {

    @ConfigProperty(name = "languages")
    String languages;

    public String getLanguages() {
        return languages;

...and configured in


...can be directly used to generate e.g. Web Components / Custom Elements:

<%@ taglib prefix="c" uri="" %>

class Languages extends HTMLElement{

        connectedCallback() {
        this.innerHTML = `
                <c:forEach items="${developer.languages}" var="language">


See it in action and from scratch:

The 4kB ThinWAR project was created with Jakarta EE Essentials Archetype and deployed with: in 2.4s


Post a Comment:
  • HTML Syntax: NOT allowed
...the last 150 posts
...the last 10 comments