close

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.support.RequestContextUtils;

public class MyTag extends BodyTagSupport {

    private WebApplicationContext _applicationContext;

    private void initApplicationContext(){
        _applicationContext = RequestContextUtils.getWebApplicationContext(
             pageContext.getRequest(),
             pageContext.getServletContext()
        );
    }

    public int doStartTag() throws JspException {
        if(_applicationContext == null)initApplicationContext();

        // …

    }

}

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Jemmy 的頭像
    Jemmy

    Jemmy Walker

    Jemmy 發表在 痞客邦 留言(0) 人氣()