Software requirement for First Spring Boot Project in Eclipse
- JDK 8
- Eclipse
Setup First Spring Boot Project in Eclipse by using spring boot initializr
Go to Google and search for spring boot initializr. Go to the first result from Google search . That is here
Spring Boot can be setup in eclipse by using start.spring.io. Follow my youtube video to complete Spring boot web application setup.
After setting Spring Boot in Eclipse the Project Explorer will look like following
View the following video for complete guidance of creating jsp in first Spring web application in Eclipse.
Create a JSP named index.jsp inside src\main\webapp\WEB-INF\jsp
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body bgcolor="cyan"> <h1 align="center">Hello Spring Boot</h1> </body> </html>
Add jasper dependency in pom.xml
The following dependency must be written inside of pom.xml between start and end of dependencies tag.
<dependencies>...</dependencies>
insert the following between above tags in pom.xml
<!- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-jasper --> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> </dependency>
Change application.properites file
This file can be found inside in the shown location Java Resources–src/main/resources
The following code required in application.poperties file to let the spring application manager know the location of jsp file.
spring.mvc.view.prefix:/WEB-INF/jsp/ spring.mvc.view.suffix:.jsp
Finally run the application
Right click on the java file which contains main method
or
Open the file and right click on code
Run—–Run As—Java Application
Open the app in web browser
Use localhost:8080 as the URL to view output of index.jsp
This is response to the question
How to create and see output of a spring boot application without custom defined or user defined controller .