0% found this document useful (0 votes)
8 views10 pages

Spring Boot Project Setup with STS

This document provides a step-by-step guide to create a Spring Boot project using Spring Tool Suite (STS), detailing the project structure and necessary configurations. It includes instructions for creating the project, modifying the pom.xml file to add dependencies, creating a controller, and setting up JSP files. Finally, it concludes with instructions to run the Spring Boot project.

Uploaded by

sairishika900
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

Spring Boot Project Setup with STS

This document provides a step-by-step guide to create a Spring Boot project using Spring Tool Suite (STS), detailing the project structure and necessary configurations. It includes instructions for creating the project, modifying the pom.xml file to add dependencies, creating a controller, and setting up JSP files. Finally, it concludes with instructions to run the Spring Boot project.

Uploaded by

sairishika900
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Creating a Spring boot project using Spring Tool Suite (STS)

1. Project Structure:
first-spring-boot/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/example/demo/
│ │ │ └── [Link]
│ │ ├── resources/
│ │ │ ├── [Link]
│ │ └── webapp/
│ │ └── WEB-INF/
│ │ └── views/
│ │ └── [Link]
├── [Link]

2. Create a Project:

2.1 Click on Spring Starte Project

2.2 Provide below details.


Name: first-spring-boot
Type: Maven
Packaging: Jar
Java Version: 17
Language: Java
Group: [Link]
Artifact: first-spring-boot
Package: [Link]

2.3 Search for Spring web and Select Spring Web, Click next and Finish. It will create a new
project in Package Explorer.
2.4 Confirm below folder structure is created.

3. Modify the [Link] file, add the dependencies in the file and save it.
<!-- JSP Support -->
<dependency>
<groupId>[Link]</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>[Link]</groupId>
<artifactId>[Link]-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>[Link]</groupId>
<artifactId>[Link]-api</artifactId>
</dependency>
<dependency>
<groupId>[Link]</groupId>
<artifactId>[Link]</artifactId>
</dependency>

4. Check the Main Spring Boot Application is correct.

5. Create a controller folder inside [Link] package


6. Create new controller class inside [Link] package with below code.
package [Link];

import [Link];
import [Link];

@Controller
public class HomeController {

@GetMapping("/")
public String home() {
return "home"; // JSP file name ([Link])
}
}
7. Add JSP files folder path configurations in [Link].
[Link]=/WEB-INF/views/
[Link]=.jsp
8. Create Folder path src/main/webapp/WEB-INF/views. Add [Link] file and copy below
code.
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Welcome</title>
</head>
<body>
<h2>Hello, Spring Boot with JSP!</h2>
</body>
</html>
9. Run the Spring boot project.

You might also like