JAVA/Java
20201123 _스프링 톰캣 맛보기
JENN_tech7
2020. 11. 23. 23:24
728x90
SMALL
new project - web - Dynamic Web Project
이름 설정하고 finish
(runtime에서 경로설정까지 같이 해줄 수도 있다 tomcat경로로지정하기)
JSP파일 생성해주고
UTF-8로 바꿔줌
Run On Server
tomcat검색- 9.0
browse에서 내가 tomcat깔았던 경로 설정해주고 finish누르면
이렇게 뜨고 밑에도 뭐 localhost 잘 뜬듯..?
<%@page import="java.util.Optional"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>환경설정넘모어렵다</title>
</head>
<body>
<%!
private long factorial(long n) {
long result = 1;
while (n >= 1) {
result *= n--;
}
return result;
}
%>
<%
// /path
String nValue = request.getParameter("n");
String n = Optional
.ofNullable(nValue)
.orElse("1");
long result = factorial(Long.valueOf(n));
%>
<h1>._.</h1>
결과: <%= result %>
</body>
</html>
728x90
LIST