Skip to content

3.0 Helloworld example

JoostNoterik edited this page May 6, 2015 · 5 revisions

Here you will find the basic Helloworld example in the MST

package org.springfield.lou.application.types;
import org.springfield.lou.application.*;
import org.springfield.lou.screen.*;

public class HelloworldApplication extends Html5Application {

public HelloworldApplication(String id) {
	super(id); 
}

     public void onNewScreen(Screen s) {
     	setContent("defaultoutput", "Helloworld!"); 
   }
}

But just as a important is the basic container it needs to be in, where do you place all our files and how do you package them. We follow the normal 'war' format and you can use regular IDE's for example in eclipse the complete HelloWorld Application could look like this

basic app

There are more than a few directories and files but if you are known with j2ee apps most should be known to you and we included examples that you can copy and adapt to get you started. One thing that is important is some of the names and placed you put stuff since that can lead to automatic actions. For example your main java program should always be in the 'org.springfield.lou.applications.types' package and its name directly linked to the main folder this will allow the application manager we build in to automatically upload, distribute and execute it correctly. The logic is as follows

  dir : smt_[name]
  war : smt_[name].war
  java package : org.springfield.lou.application.types
  main class : [Name]Application.java (notice the first character of the name is Uppercase.
  webContent : eddie/apps/[name]

Not following these guidelines will end in problems somewhere for sure since everything in the MST is done dynamically and mapping based on names is done a lot.

We advice you watch the 'HelloWorld' video to see how to install and upload it to a springfield cluster and see how to call it from the browser.