- Springsource Tool Suite
- Springsource Tool Suite Eclipse Plugin
- Springsource Tool Suite 4 Download
- Spring Sts Download
- Springsource Tool Suite 4
- Spring Source Tool Suite
- Springsource Tool Suite Download
Now available Spring Framework: Persistence & Transaction – Web & JSP
This is the second tutorial working with SpringSource Tool Suite, in this time I am going to teach you how create a simple Spring MVC application. If you are a beginner with SpringSource Tool Suite, then I suggest you read before the first tutorial about Getting Started with SpringSource Tool Suite. If you are a beginner with Spring Web MVC, then be sure to read first this 16. Web MVC framework.
Springsource-tool-suite-2.9.2.RELEASE-e3.7.2-macosx-carbon- installer.exe or springsource-tool-suite-2.9.2.RELEASE-e3.7.2-macosx-carbon.tar.gz Carbon 32-bit Preparing the Installer on Linux Download the STS self-extracting shell script (.sh) that matches your OS and machine architecture from the STS download page.
SpringSource Tools Suite (STS) Now let's explore deploying the Spring Travel application to Cloud Foundry. This Section will guide you through the combined use of SpringSource Tool Suite(STS) and Micro Cloud Foundry(MCF). Last modified: Wed Jun 24 06:56:25 UTC 2020: Last modified by: tim.lebedk. Created: Wed Jun 24 06:55:26 UTC 2020: Created by: tim.lebedk. Automated tests.
The SpringSource‘s developer team given us a powerful option within SpringSource Tool Suite to make our development cycle easier, this option is called Spring Template Project where within this option we have some defined templates where these are based on specific Spring Projects.
The purpose of each template according its own type is create a project with some default configuration settings in your favor to avoid repeat always the same configuration settings process when you create the same project’s type each time. For example, the project is going to be created including all the mandatory Maven dependencies, of course, it depends of the Spring Project type chosen, furthermore, including some basic configuration settings and Java code. Even more, for example, the template based on MVC (covered later in this tutorial), is already created with the classic directory structure for Java Web Applications (WEB-INF etc).
Again, I am going to work with Linux Fedora Core 15, and with Java SE Development Kit 6 Update 29.
Note: In many of the follow images you are going to realize that many of them has been captured on Windows. It is due that Linux cant capture some desired screens and futhermore I am including some detailed instructions for your favor.
OK Let’s go!. Startup your SpringSource Tool Suite 2.8.1
Step 01: Creating a Spring Template Project
Once started up the IDE simply do the follow. File->New->Spring Template Project.
Figure 01: Creating a Spring Template Project
Step 02: Creating a Spring MVC Project
Once has selected the Spring Template Project option then you must now select a Template. Since this tutorial is based on MVC, therefore select the item Spring MVC Project. Below an image which show all the rest of the Templates available.
Figure 02: Creating a Spring MVC Project
Do realize yourself that each item has in the left part a green row. In the same image you can see the description of the green row, which means requires downloading. It only happen just only one time when you create a project the first time based on a specific template, and it is to get the desired template.
OK, from our previous image proceed to do click in the button Next >. Since it going to be our first time that we create a project based in this type of template we are going to receive the follow message. See below the respective image.
Figure 03: Downloading the Spring MVC Project Template
Proceed to do click in the button Yes. This downloading process should be very quickly.
Step 03: Defining the Project Settings
The next step is simply write the project name and define the top-level package. For each one respectively I am going to use manolitomvc and com.manuel.jordan. Below an image for a better understanding.
Figure 04: Project Settings for the Spring MVC Project
Once you have written these values, proceed to do click on the button Finish. With all these instructions, we have created our Spring MVC Project. Below an image showing part of the whole project structure.
Figure 05: Spring MVC Project created
Do realize yourself that the project directory structure is based on Apache Maven and you can see part of the Web directory structure too. In the next image you can see a little more expanded this structure
Figure 06: Spring MVC Project Web directory structure
Note: Some times, not always!, due the Spring Core dependencies managed by Maven, more details soon!, you could get an error in your project directory. See the next image for a better understanding.
Figure 07: Spring MVC Project with error
If you got this error, dont worry, just ignore it by the moment, later on Step 05, you are going to learn how to eliminate this error.
Step 04: Disabling the option Build Automatically (Optional)
It is my own opinion, but I think is wise disable the option Build Automatically for our IDE to avoid some problems when you are editing your code. To disable this feature, just do the follow Project->Build Automatically. Below an image showing this option enabled yet. when you have finished to do my instruction, the black row must disappear.
Figure 08: Option Build Automatically enabled
Step 05: Configuring pom.xml
It is an important step for our consideration. Open the file named pom.xml, it must be located in the bottom of the directory structure, see Figure 07. While I am writing this tutorial the latest current release but not stable of Spring Core is 3.1.0.RC2.
Once opened this file, practically in the top you are going to find the follow line:
Spring Core 3.0.6.RELEASE is the latest stable current release. For this tutorial I am going to work with Spring Core 3.1.0.RC2. Therefore update the line shown above in this way:
Due this update we now must include a repository in to our pom.xml file to let our project get the Spring Core dependencies, otherwise we are going to get problems.
Until this point you can save the pom.xml file. In this point the IDE must try to get the Spring Core dependencies for the version 3.1.0.RC2.
Note: Like I said before, perhaps you get an error in your project directory. I think due the Spring Core dependencies managed by Maven. See the next image for a better understanding.
Springsource Tool Suite
Figure 09: Spring MVC Project with error
Ok, to fix this, just do the follow. Select the project directory manolitomvc, see the previous image, and then do Project->Clean….
Figure 10: Cleaning a Project (Part 01)
Afterwards to do this, you should get the follow screen.
Figure 11: Cleaning a Project (Part 02)
Since our IDE has been installed and it is our first project, therefore has sense only see one project. Just select our project through the checkbox, to do this, before you must do click in the radio button named Clean projects selected below and later be sure to uncheck the checkbox named Start a build immediately. To understand these instructions see the follow image.
Figure 12: Cleaning a Project (Part 03)
Once you got the previous screen in your IDE, proceed to do click in the button OK. The error still yet, then be sure you have selected our project directory and then do the follow Project->Build.
Figure 13: Building a Project
Afterwards to do this, the error has gone. Below the final result.
Figure 14: Spring MVC Project without error
Step 06: Editing our @Controller (Optional)
This step is optional, be free to skip it.
Note: Again, if you are a beginner with Spring Web MVC, then be sure to read first this 16. Web MVC framework.
Go to src/main/java and expand the package com.manuel.jordan and open the HomeController.java file.
Figure 15: Opening the HomeController.java file
Once opened this class you must see the complete source code. Below I am showing part of the HomeController source code.
Figure 16: HomeController’s source code (Partial view)
In this class, we have the unique method named home. In this method we have this line of code:
model.addAttribute(“serverTime”, formattedDate );
Just below of such line write this new one.
model.addAttribute(“welcomeMessage”, “Welcome To Manuel’s Sample Application” );
The final result must be like the follow image
Figure 17: HomeController’s home method edited
Step 07: Showing Line Numbers (Optional)
If you did realize yourself, we have not line numbers in our HomeController source code. Therefore to make our development work easier, lets activate it. Just do right click in the left part of the window where appear the HomeController source code and select Show Line Numbers. Below an image for a better understanding.
Figure 18: Activating Line Numbers within HomeController
Once activated this option you are going to see the line numbers within the HomeController class, even more, you going to see this feature for all the files in your IDE (practically for all your projects), such as .java files, .jsp files, .xml files, .properties files. See the follow image where HomeController is visible now with the line numbers in the left part.
Figure 19: Line Numbers Included within HomeController
Step 08: Editing our JSP file (Optional)
Once edited our HomeController class, now we must edit the home.jsp file. To do this, go to src/main/webapp/WEB-INF/views and open the home.jsp file.
Figure 20: Opening the home.jsp file
Once opened this file, you must see the complete source code.
Figure 21: home’s source code
In this JSP file, we have this line of code:
Just below of such line write this new one.
The final result must be like the follow image
Springsource Tool Suite Eclipse Plugin
Figure 22: home’s source code edited
Step 09: Opening the Servers View to configure the VMware vFabric tc Server Developer Edition
After to have edited our source code, we are able to execute it. Before to do this, be sure to Build our application to reflect these two editions. Select the project directory and then do the follow Project->Build. See Figure 13 located in the Step 05 for a better understanding.
SpringSource Tool Suite 2.8.1 has included by default the VMware vFabric tc Server Developer Edition v2.6. Perhaps you cant see this server in your IDE, because the Servers view is not visible yet. If you have this situation, just do the follow Window->Show View->Other…
Figure 23: Opening Servers View (Part 01)
Then go to the Server directory and select the unique item named Servers and finally do click in the button OK.
Figure 24: Opening Servers View (Part 02)
Once done this, you must see the VMware vFabric tc Server Developer Edition v2.6 within the Servers view like the follow image.
Figure 25: Servers View
If you see again the Figure 23, notice that Servers option already appear, well some times no appear, that’s why I am teaching you in this way.
Step 10: Configuring the VMware vFabric tc Server Developer Edition
Once we are able to see the Servers view we can configure our VMware vFabric tc Server Developer Edition v2.6 to work with our Spring MVC application. To do this, in the VMware vFabric tc Server Developer Edition v2.6 proceed to do right click and select the item named Add and Remove….
Figure 26: Selecting the Add and Remove… option
Once done this, perhaps you would see the project manolitomvc in the left part named Available. If it is the case just select the project and do click in the button Add >. Now our project manolitomvc must be located in the right part named Configured. For the moment keep checked the checkbox named If server is started, publish changes immediately. See the follow image to understand the final configuration. Once done this, proceed to do click in the button Finish
Figure 27: Moving the manolitomvc project to the Configured section
Step 11: Starting the VMware vFabric tc Server Developer Edition
With the previous configuration, our manolitomvc project is able to be considered to be developed by the VMware vFabric tc Server Developer Edition v2.6.
Therefore we are now able to startup the server. To do this, again in the VMware vFabric tc Server Developer Edition v2.6 proceed to do right click and select the item named Start.
Figure 28: Starting VMware vFabric tc Server Developer Edition v2.6 (Way 01)
Other way to startup the server is doing click in the green circle icon located in the right part, see the follow image the red circle which contains this icon.
Springsource Tool Suite 4 Download
Figure 29: Starting VMware vFabric tc Server Developer Edition v2.6 (Way 02)
Once given the order to startup the server in either of the two forms available, you should see the follow output.
Figure 30: VMware vFabric tc Server Developer Edition v2.6 Started
Step 12: Opening the Internal Web Browser
Once started the server, our IDE should automatically open the Internal Web Browser view. If it is not the case, do the follow Window->Show View->Other….
Figure 31: Opening Internal Web Browser View (Part 01)
Then go to the General directory and select the unique item named Internal Web Browser and finally do click in the button OK.
Figure 32: Opening Internal Web Browser View (Part 02)
Step 13: Running our Spring MVC application
Once you got the Internal Web Browser view, write the follow URL http://localhost:8080/manolitomvc/ and press enter or do click in the green triangle located in the right part. When you have done either these two options to execute the URL. You should get the follow output.
Figure 33: Running manolitomvc application
Notice the Console View output, we have a logs INFO message. It is in color black.
Figure 34: Running the manolitomvc application
Each time you execute the URL, a new logs INFO message should appear.
Step 14: Shutdown the VMware vFabric tc Server Developer Edition
If you recall, in the Step 11, we are able to startup our server in two ways, in the same way, we can shutdown our server in two ways.
The first way is the follow, again in the VMware vFabric tc Server Developer Edition v2.6 proceed to do right click and select the item named Stop.
Spring Sts Download
Figure 35: Shutdown VMware vFabric tc Server Developer Edition v2.6 (Way 01)
The second way to is doing click in the red square icon located in the right part.
Figure 36: Shutdown VMware vFabric tc Server Developer Edition v2.6 (Way 02)
Once stopped the server, in the Console view you must see some log messages indicating that the server was shutdown successfully (I am not posting an image about this).
Step 15: Exporting manolitomvc.war file
The last step of this tutorial is export the .war file of our project. I am going to use this .war for other tutorials. To export our project do right click in the project directory and choice the item Export….
Springsource Tool Suite 4
Figure 37: Exporting manolitomvc.war file (Part 01)
Spring Source Tool Suite
Once done this, go to the Web directory and select the item WAR file and do click in the button Next >.
Springsource Tool Suite Download
Figure 38: Exporting manolitomvc.war file (Part 02)
Now do click in the button Browse… and select the destination, I am going to use my Desktop. Leave the rest of the options without changes. Below the image with the final result.
Figure 39: Exporting manolitomvc.war file (Part 03)
Once done this, just do click in the button Finish
Final Notes: Congratulations!!!. You have learned how create a Spring MVC application, configure our IDE, edit the project’s source code , startup and shutdown the VMware vFabric tc Server Developer Edition v2.6 and finally how to export a .war file.
In the coming tutorials I am going to use this .war file. Be ready!