Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Dom elements set attribute

Batgerel Enkhbat
3 years ago Apr 16, 2019 2:19am
Olli Tietäväinen
3 years ago Apr 16, 2019 11:59am

There's an add-on for that purpose: https://vaadin.com/directory/component/htmlattributehandler

It's marked for Vaadin 7, but works for 8 as well as-is.

Usage example:

        Label label = new Label("Vaddin");
        ComponentAttributeHandler cah = new ComponentAttributeHandler();
        cah.setComponent(label);
        cah.setAttribute("foo", "bar");
Batgerel Enkhbat
3 years ago Apr 17, 2019 12:31am