티스토리 뷰

스프링 bean에 등록된 편의 객체 접근

${@객체명.hello('값')} 으로 접근 가능

 

html

<h1>편의 객체</h1> <ul>
    <li>Request Parameter = <span th:text="${param.paramData}"></span></li>
    <li>Request Parameter = <span th:text="${param.paramData}"></span></li>
    <li>session = <span th:text="${session.sessionData}"></span></li>
    <li>session = <span th:text="${session.sessionData}"></span></li>
    <li>spring bean = <span th:text="${@helloBean.hello('Spring!')}"></span></li>
    <li>spring bean = <span th:text="${@helloBean.hello('Spring!')}"></span></li>
</ul>

 

java

   @Component("helloBean")
    static class HelloBean{
        public String hello(String data){
            return "Hello" + data;

        }
    }

 

'dev > spring boot + intelliJ' 카테고리의 다른 글

thymleaf 연산  (0) 2023.05.03
thymleaf 리터럴  (0) 2023.05.03
thymeleaf Object 표시, th:with 지역변수 사용  (0) 2023.04.06
thymeleaf escape unEscape  (0) 2023.04.02
롬복사용 dto와 테스트 코드작성  (0) 2021.07.26
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/08   »
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
글 보관함