Daniela Morais
Daniela Morais

Reputation: 2247

JSP in Spring Boot

I have a JSP page like index of my application, it is located in /resources/jsp/index.jsp. I've set for when a certain route to parth this page is called. But I get a 404 when I open localhost because SpringBoot is putting .vm extension at the end of the file.
How do I fix this?

Log

2015-07-15 08:39:51.226 ERROR 3977 --- [nio-8181-exec-1] org.apache.velocity                      : ResourceManager : unable to find resource '/jsp/index.jsp.vm' in any resource loader.
2015-07-15 08:39:51.290 ERROR 3977 --- [nio-8181-exec-1] org.apache.velocity                      : ResourceManager : unable to find resource 'error.vm' in any resource loader.

Index API

@RequestMapping(value = "", method = RequestMethod.GET)
    public ModelAndView getIndex() {
        return new ModelAndView("/jsp/index.jsp");
    }

This happens even I put JSP extension in configuration Application.properties

spring.application.name=VeiculoService

spring.data.mongodb.uri=mongodb://localhost:27017/oknok

spring.data.rest.baseUri=/api

spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
spring.http.gzip.enabled=true

spring.view.suffix= .jsp

management.context-path=/actuator

info.app.name=OKNOK Admin
info.app.description=OKNOK
info.app.version=${project.version}

server.port=${port:8181}
server.servletPath=/

Upvotes: 1

Views: 731

Answers (1)

Sanjay
Sanjay

Reputation: 8975

Spring Boot has some limitations in handling JSPs. Precisely, it suggests to keep the JSPs inside the src/main/webapp folder, and change the packaging from jar to war.

Upvotes: 2

Related Questions