Vote count:
0
I've been trying for a while and I really can't wrap my head around running SpringMVC (Annotation-based MVC configuration) project with embedded jetty while managing dependencies with gradle.
I managed to display jsp page, but jsp tags are not parsed? executed? My setup looks like this: build.gradle:
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
sourceSets.main.resources.srcDirs = ['src/main/resources', 'webapp']
sourceSets.main.java.srcDirs = ['src/main/java']
dependencies {
compile 'javax.servlet.jsp:jsp-api:2.2'
compile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'javax.servlet.jsp.jstl:jstl-api:1.2'
compile 'org.springframework:spring-webmvc:4.1.6.RELEASE'
compile 'org.apache.logging.log4j:log4j-core:2.2'
compile 'org.eclipse.jetty:jetty-webapp:9.2.10.v20150310'
}
My view resolver is configured like this:
@Bean
public InternalResourceViewResolver jspViewResolver() {
InternalResourceViewResolver bean = new InternalResourceViewResolver();
bean.setPrefix("/pages/");
bean.setSuffix(".jsp");
return bean;
}
And I am trying to display this jsp page:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://ift.tt/QfKAz6" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
<c:set var="test" scope="session" value="test"/>
<c:out value="${test}"/>
</body>
</html>
Not sure what I could be missing? When deploying SpringMVC as war to tomcat the servlet-api dependency was other than 'compile' (something like targetCompile or similar), but it's embedded jetty now, so I believe compile is alright this time.
asked 1 min ago
Setup JSP with SpringMVC + Embedded Jetty + Gradle
Aucun commentaire:
Enregistrer un commentaire