Java Spring MVC, project FitnessTracker

I just finish my Lab about the framework of java Spring MVC, i like that particular framework cause is very powerful when we want to create web applications, it involve java code programming, html, javascript, server configuration, etc.

I created my personal server at home, it’s a tomcat server v9.0, and I’ve configure my router to make it public, so you can see my application running on live, click FitnessTracker, please visit my portfolio to see more java projects or other labs involving other technologies.

If you watch my code, you could see how the architecture of this MVC technology is well implemented, i mean, there are the files that represent models (my files that makes identify the entitys, activity.java, exercise.java and goal.java), the views (my JSP pages) and the controllers (files that handle the mapping request, GoalController.java, MinutesController.java).

There is also other configurations, like my POM file, where i identify my dependencies, so my maven project help me automatically download some jars that are necessary to run the application. My web.xml file,  where i set what is the servlet configuration file to use and what kind of URL extentions should handle my FitnessTracker application.

There is also my servlet-config.xml file, where i put some beans, with those beans i identify where are my JSP files located, or my messages properties files , or interceptors (the one that help me change the language on any single jsp page),  or where are my packages located (my java files), etc.

In this tutorial, i’m not using a database, but i’m planning to use it on other labs that are coming soon.


This is a project created with the java framework SPRING.
In this page i will show step by step, all the process that i used to create this project.

this is following this module..
Introduction to Spring MVC

  1. Install Java
    go to Eclipse.org, download this version.. Eclipse IDE for Java EE Developer.
    – After download i have this message..
    java runtime error
  2. Create a Maven Project
    – Right click on workspace, create a Maven Project
    – Use default Workspace location
    – On Select an Archetype, select filter “web”, and choose.. org.apache.maven.archetypes, version 1.0
    – Artifact Id: type FitnessTracker
  3. Modify POM.XML
    – go dependencies
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>4.0.3.RELEASE</version>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
    <scope>provided</scope>
    </dependency>
  4. Install Apache Tomcat
    – go to http://tomcat.apache.org/
    – download the latest version of tomcat
    – unzip under c;/Dev/Tools
    – On eclipse, on Servers view, make right click and select New – Server
    – Enter the name = Tomcat v9 Server at localhost
    – browse the location  c;/Dev/Tools
  5. Edit the web.xml fileThis file is on SRC- main – webapp – WEB-INF
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <web-app xmlns=”http://java.sun.com/xml/ns/javaee”
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
    xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”
    version=”2.5″>
    <servlet>
    <servlet-name>fitTrackerServlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/config/servlet-config.xml</param-value>
    </init-param>
    </servlet><servlet-mapping>
    <servlet-name>fitTrackerServlet</servlet-name>
    <url-pattern>*.html</url-pattern>
    </servlet-mapping><display-name>Archetype Created Web Application</display-name>
    </web-app>
  6. create the config folder
    This should be on SRC- main – webapp – WEB-INF
  7. create servlet-config.xml file
    this should it be on the config folder.

Leave a Reply

Your email address will not be published. Required fields are marked *

Ever tried. Ever failed. doesn't matter. Try Again. Fail again. Fail better