Step 8 Parameters
Our application is almost complete. The last step is to modify the ApplicationStartup class generated by the maven archetype. In applications created by the JBStrap framework, the Startup class is the application’s initialization point. Here, you have to configure the framework’s parameters, add the pages to the framework or create the menus.
Setting the application parameters
In the ApplicationStartup class, look for the parameterSettings()
method and change it so that it contains the following code:
The method already contains the majority of the settings, but there are some that you need to configure manually. These settings include:
Setting the application’s starting page. Do this by setting the ENTRY_POINT parameter. Specify the ID of the page you want to set as the starting page. In this example, we want to display the orders page as the starting page, so specify
ApplicationConstants.ORDERS_PAGE
.Next, we have to specify the application’s title. Use the APPLICATION_TITLE parameter to do this. Specify the text here that you want to display in the browser’s address bar.
Now we are ready with the parameters, but we still have to create the pages in the application.
Creating pages
Pages are created by using the createPages()
method in the ApplicationStartup
class. Modify the method, so the contents are the following:
Since there are three pages in the application, we have to write three lines. All lines are the same, only their parameters are different.
Register the pages in the JBStrap framework by using the JBStrap.addPage()
method. The first parameter of the method is the unique ID of the page that you can use later to reference the page. The second parameter is the UI class used to display the page. In this example, there is one UI only, so you have to specify this UI. The last parameter is the page class to be registered in the framework. Specify the previously created classes.
The pages are now registered, you only have to create the menu.