Use JSP in spring boot

Home / Use JSP in spring boot

How to use JSP in spring boot

In this post, we ‘ll see how to use JSP pages in spring boot project, For using JSP in spring boot we have to follow the given below steps :

1  Add the below dependency in your pom.xml file


or you can copy the above dependency for the Maven Repository

Download Dependency

2   Create a folder name JSP inside your WEB-INF folder


3  Add the following lines to your file to use JSP


4  Now make a JSP file with any name inside your JSP folder, Let’s say we create a file with name index.jsp


5  Now make a controller for URL endpoint

public String getFirstJspPage() {
System.out.println("inside first controller");
return "index";           // here index is the name of jsp file

Now just run your spring boot main class and go to your browser and type localhost:8080 you will see the content of your JSP file there.


you also may like

How to Upload files in spring boot projects .

How to create spring boot project

Help Others, Please Share

About Author

Leave a Reply

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