Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:22:59+00:00 2026-06-12T16:22:59+00:00

Certain Vaadin addons, such as Invient Charts (https://vaadin.com/directory#addon/invient-charts), require the inclusion of javascript libraries

  • 0

Certain Vaadin addons, such as Invient Charts (https://vaadin.com/directory#addon/invient-charts), require the inclusion of javascript libraries to operate.

How can this be done without having to create a custom Servlet for Vaadin applications?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:23:00+00:00Added an answer on June 12, 2026 at 4:23 pm

    Using the Scaladin addon and the Scala language, this is accomplished by the following code in the init() method on your application:

    override def init() {
      super.init()
    
      // bring in javascript needed for addons
      val jqsrc = io.Source.fromInputStream(getClass.getResourceAsStream("/js/jquery-1.4.4.min.js"))
      val hcsrc = io.Source.fromInputStream(getClass.getResourceAsStream("/js/highcharts.js"))
      val xpsrc = io.Source.fromInputStream(getClass.getResourceAsStream("/js/modules/exporting.js"))
      mainWindow.executeJavaScript((jqsrc ++ hcsrc ++ xpsrc).mkString)
      jqsrc.close(); hcsrc.close(); xpsrc.close() }
    

    Note that the javascript files being opened as InputStreams must be in the classpath. To do this using SBT, make a resources directory under the src/main dir, and put the /js dir and the .js files within. These will be put into the WEB-INF/classes dir when the war file is built. They will also appear in the classpath when you use container:start from the xsbt web plugin, so the same code allows for testing prior to making the .war file.

    This approach should be able to work without Scala (but with a lot more Java code), but what fun would that be?

    A more efficient way would be to load the JavaScript code into a string held in an object to avoid having to repeatedly read it in:

    object Script {
      val js = Seq("/js/jquery-1.4.4.min.js", "/js/highcharts.js", "/js/modules/exporting.js") map { f =>
        val in = io.Source.fromInputStream(getClass.getResourceAsStream(f))
        val s = in.mkString
        in.close()
        s
      }
    }
    

    and then in the Vaadin Application:

    class MyApp extends Application(title = "My App", applicationTheme = "reindeer")  {
      override def init() {
        super.init()
    
        // bring in javascript needed for addons
        Script.js foreach mainWindow.executeJavaScript
      }
    .
    .
    .
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In certain areas of development such as game development, real time systems, etc., it
I have a vaadin table where I use certain filters for filtering, just like
If certain conditions are met, I want to copy a file from one directory
In certain places such as Mail.app, the top navigation bar is thinner in landscape
On certain internet connections I've found with certain sites such as Facebook, the CSS
In certain circles best practices suggest registering JavaScript files (js) at the end of
A certain parameter has 3 possible values, and there are n such parameters with
Certain Variables I use acrross Javascript and PHP, for example JSON_ON. I need it
Certain list comprehensions don't work properly when I embed IPython 0.10 as per the
In certain types of code (e.g. simulation/ games/ optimization), many physical quantities/properties are stored,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.