Open iamsungink opened 2 months ago
WebApp 구성
src/main/webapp
tomcat-jsper-dependency 추가하면 기본 설정을 탐 아래 참고
참고) JspTemplateAvailabilityProvider.java 참고
public class JspTemplateAvailabilityProvider implements TemplateAvailabilityProvider {
@Override
public boolean isTemplateAvailable(String view, Environment environment, ClassLoader classLoader,
ResourceLoader resourceLoader) {
if (ClassUtils.isPresent("org.apache.jasper.compiler.JspConfig", classLoader)) {
String resourceName = getResourceName(view, environment);
if (resourceLoader.getResource(resourceName).exists()) {
return true;
}
try {
return new File("src/main/webapp", resourceName).exists();
}
catch (AccessControlException ex) {
}
}
return false;
}
private String getResourceName(String view, Environment environment) {
String prefix = environment.getProperty("spring.mvc.view.prefix", WebMvcAutoConfiguration.DEFAULT_PREFIX);
String suffix = environment.getProperty("spring.mvc.view.suffix", WebMvcAutoConfiguration.DEFAULT_SUFFIX);
return prefix + view + suffix;
}
}
Project Structure > Modules
main > Web
Web Resource Directories 추가
C:\data\projects\fastcampus\spring-full-edition\src\get-in-line-ex\src\main\webapp
OK 클릭
application.properties
spring.mvc.view.suffix=.html
인텔리제이에게는 webapp이 웹리소스 경로라는걸 알려줘야 되고
*** springboot은 jsp 프로그래밍을 한다면 일단 기본 값 src/main/webapp 기본경로로 봄
어려움
템필릿엔진을 사용해야 편함
starter-thymeleaf
jsp 프로그래밍 시 spring boot 설정 (with intellij)