For the last few days, I have not had time to work on the project. Now there is simple page displayed as an initial project page.

Added spring framework dependencies in pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.billingsystem</
groupId>
<artifactId>BillingSystem</artifactId>
<version>0.0.1</
version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework</
groupId>
<artifactId>spring-core</artifactId>
<version>4.3.7.RELEASE</
version>
</dependency>
<dependency>
<groupId>org.springframework</
groupId>
<artifactId>spring-web</artifactId>
<version>4.3.7.RELEASE</
version>
</dependency>
<dependency>
<groupId>org.springframework</
groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.7.RELEASE</
version>
</dependency>
</
dependencies>
</project>

Simple view:

<html>
<body>
<h1>message : ${message }</h1>
</
body>
</html>

Controller:

package com.billingsystem.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/hello")
public class HelloController {

@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index(ModelMap model) {
model.addAttribute("message", "Spring MVC");
return "hello";
}
}

Created dispatcher servlet configuration:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"
>
<context:component-scan base-package="com.billingsystem.controller"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</
property>
<property name="suffix">
<value>.jsp</value>
</
property>
</bean>
</
beans>
Architecture
Architecture

The picture above presents the basic appearance of the page that will appear after run changes. For now, there are not many changes, but it is a necessary attitude to make new changes and work on the application.


Reference:

  1. Spring
  2. Spring Framework