티스토리 뷰

참고 : https://java.ihoney.pe.kr/472

참고 : https://eblo.tistory.com/56

 

# application.properties 값 조회

@ 뒤에 빈(Bean) 이름을 사용하면 그 빈에 접근할 수 있다.

<span th:text="${@environment.getProperty('app.title')}"></span>

프로파일 환경에 따라 표시를 하려면

<div th : if = $ { @environment .acceptsProfiles ( 'production' )}>
    This is the production profile
</ div>
또는
<div th : if = "$ {# arrays.contains (@ environment.getActiveProfiles () 'production')} " >
     This is the production profile
</ div>

# 시스템 환경변수 조회

${@systemProperties['property.key']}

# 메세지 조회

<span th:text="#{msg.example.title}"></span>

# 세션정보 조회

<span th:text="${session['userId']}"></span> 

<span th:text="${session.userId}"></span> 

# 파라미터 조회

<span th:text="${param.authType}"></span> 

<span th:text="${#httpServletRequest.getParameter('authType')}"></span> 

# PathVariable 조회

<span th:text="__${userId}__"></span>

* Spring 컨트롤러에 Request Mapping에 선언되어 있고 @PathVariable이 있어야만 정보를 가져올 수 있다.

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31