Vaadin 14 show simple HTML Page

I made some kind of internal manual for a webapp that i am developing. I am using Spring Boot and Vaadin 14. How to implement a button that shows that document? The html doc is in my resources folder. I wonder if i am stupid. Or should i write my own controller for this?


A Vaadin application itself is a single dynamic HTML page.

The easiest way to include HTML formatted content (not an HTML document) is to use the Html component.

Html html = new Html("<div><h3>Title</h3><p><b>Bold summary text</b></p><p>Other text</p></div>");

Note, when you use the Html component, you need to strip the <head> and <body> tags, as Html‘s purpose is not to show full HTML documents. The Html component’s content should be included inside a single root element – usually a <div> is used for this purpose.

However, based on your use case, I think the Html component will serve you well.


Spark: unable to load native-hadoop library for platform

I am trying to start with Spark. I have Hadoop (3.3.1) and Spark (3.2.2) in my library. I have set the SPARK_HOME, PATH, HADOOP_HOME and LD_LIBRARY_PATH to their respective paths. I am also running JDK 17 (echo and -version work fine in the terminal).

Yet, I still get the following error:

Using Spark's default log4j profile: org/apache/spark/
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
21/10/25 17:17:07 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
java.lang.IllegalAccessError: class$ (in unnamed module @0x1f508f09) cannot access class (in module java.base) because module java.base does not export to unnamed module @0x1f508f09
  at org.apache.spark.SparkEnv$.$anonfun$create$9(SparkEnv.scala:348)
  at org.apache.spark.SparkEnv$.registerOrLookupEndpoint$1(SparkEnv.scala:287)
  at org.apache.spark.SparkEnv$.create(SparkEnv.scala:336)
  at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:191)
  at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:277)
  at org.apache.spark.SparkContext.<init>(SparkContext.scala:460)
  at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2690)
  at org.apache.spark.sql.SparkSession$Builder.$anonfun$getOrCreate$2(SparkSession.scala:949)
  at scala.Option.getOrElse(Option.scala:189)
  at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:943)
  at org.apache.spark.repl.Main$.createSparkSession(Main.scala:106)
  ... 55 elided
<console>:14: error: not found: value spark
       import spark.implicits._
<console>:14: error: not found: value spark
       import spark.sql
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _ / _ / _ `/ __/  '_/
   /___/ .__/_,_/_/ /_/_   version 3.2.0
Using Scala version 2.12.15 (OpenJDK 64-Bit Server VM, Java 17.0.1)
Type in expressions to have them evaluated.
Type :help for more information.

Any ideas how to fix this?


Java 17 isn’t supported – Spark runs on Java 8/11 (source:

So install Java 11 and point Spark to that.

The warning unable to load native-hadoop library for platform is quite common and doesn’t mean that anything’s wrong.


How to save from JTable to CSV or Excel?

Is there a way to save JTable data to excel? I would like to save the data that I input from the program, from the table and then to a CSV file.

I would like to have it so that there is a button that will then save the inputted data from the GUI into the table and then to the CSV file.


This may help you:-

Method to write to a csv file.

public static void exportToCSV(JTable table,
        String path) {

    try {

        TableModel model = table.getModel();
        FileWriter csv = new FileWriter(new File(path));

        for (int i = 0; i < model.getColumnCount(); i++) {
            csv.write(model.getColumnName(i) + ",");


        for (int i = 0; i < model.getRowCount(); i++) {
            for (int j = 0; j < model.getColumnCount(); j++) {
                csv.write(model.getValueAt(i, j).toString() + ",");

    } catch (IOException e) {
       System.out.println("Error "+e);

For reading and showing it to a JTable you can use OpenCSV.

CSVReader reader = new CSVReader(new FileReader("file.csv")); 
List list = reader.readAll();
JTable table = new JTable(list.toArray());

How to load an external JavaScript on a condition

The question is how to rewrite a static HTML script embedding:

<script async id="__script__id__"

into a programmatic embedding which allows loading the script only on a certain condition.

The bounty is set for a description of how static/programmatic embedding differ from one another, specifically:

  1. Explain how JS specification treats programmatically added scripts — when they are loaded and executed — with authoritative references.
  2. Explain how converting script embedding from HTML inline to programmatic affects browser optimizations (it’s known that browser scans for HTML script tags with src attribute and preloads them) with authoritative references.


If you’ve already figured out how to detect your criteria then loading another script goes like this:

<!-- the usual head stuff goes here -->
// replace `criteria` with your actual criteria
if(criteria) {
  const script = document.createElement('script'); = '__script__id__';
  script.type = 'text/javascript';
  script.async = true;
  script.src = '//';
<!-- remaining scripts go here -->
<!-- injected script will end up here -->

Check for the criteria, create the element, set its properties, add it to the document.

I took a shot at finding details on this mechanism. The best I could find was from MDN on the topic of script element async and defer properties:

The exact processing details for these attributes are complex, involving many different aspects of HTML, and therefore are scattered throughout the specification. These algorithms describe the core ideas, but they rely on the parsing rules for <script> start and end tags in HTML, in foreign content, and in XML; the rules for the document.write() method; the handling of scripting; and so on.

Unfortunately, I do not have the necessary familiarity with W3’s various HTML specs to turn it into plain English and it looks like it would take quite a bit of time to become that familiar.


Clicking over hidden element in Cypress is not working

I am running into this problem without finding a good solution. I tried every post that I found in Google but without success. I am isolating the problem so I can share you the exact point. I am searching an specific product in “” and I want to sort the list from the lower price to the maximum. To do so you can enter directly here and clicking over the option “Menor Precio”.

enter image description here

Doing manually this just works fine but with Cypress I am not being able to do that. This script just runs fine but the last step seems to have no effect.

// Activate intelligence
/// <reference types="Cypress" />

describe("Main test suite for price control", () => {
    it("search scanners and order them by ascending price", () => {
      // Web access

      // Order by ascending price
      cy.get(':nth-child(2) > .andes-list__item-first-column > .andes-list__item-text > .andes-list__item-primary').click({force: true})

Maybe Am I using a bad approach to refer the object?

Best regards!


I would retry menu until options become visible

Cypress.on('uncaught:exception', () => false)

before(() => {

it('retries the menu open command', () => {

  function openMenu(attempts = 0) {
    if (attempts > 6) throw 'Failed open menu'

    return cy.get('button.andes-dropdown__trigger').click()
      .then(() => {
        const option = Cypress.$('.andes-list:visible') // is list visible
        if (!option.length) {
          openMenu(++attempts)  // try again, up to 6 attempts

  openMenu().then(() => {
    cy.get('a.andes-list__item:contains(Menor precio)').click()

  // Verification
  cy.contains('.ui-search-result__wrapper:nth-child(1)', '$490', {timeout:20000})
Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..