1. RequestContextAwareTag 상속받기
1 2 3 4 5 6 7 8 9 10 11 | public class XXXTag extends RequestContextAwareTag { @Override protected int doStartTagInternal() throws Exception { // WebApplicationContext 를 얻는다. WebApplicationContext ctx = getRequestContext().getWebApplicationContext(); // bean 주입 return SKIP_BODY; } } | cs |
2. request 사용하기
1 2 3 4 5 6 7 8 9 10 11 | public class XXXTag extends SimpleTagSupport { @Override public void doTag() throws JspException, IOException { PageContext context = (PageContext) getJspContext(); HttpServletRequest request = (HttpServletRequest) context.getRequest(); ApplicationContext applicationContext = RequestContextUtils.findWebApplicationContext(request); // bean 주입 } } | cs |
'Dev > frontend' 카테고리의 다른 글
표현 언어 (EL - Expression Language) (0) | 2017.11.01 |
---|---|
JSTL 일정 시간 후 페이지 Refresh 하기 (0) | 2017.11.01 |
apache taglibs (EL, JSTL) 사용파일 (0) | 2017.11.01 |
HTML에 특수 문자들을 명시하는 방법 (0) | 2017.11.01 |
HTTP Header (0) | 2017.11.01 |