control에서 bean객체 얻어오기
1. web.xml셋팅
<servlet-mapping>
<servlet-name>test2</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2.
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
HttpSession session = request.getSession();
ServletContext conext = session.getServletContext();
WebApplicationContext wContext = WebApplicationContextUtils.getWebApplicationContext(conext);
mybean sBean = (mybean)wContext.getBean("sampleBean");
or
WebApplicationContext ctx = ContextLoader.getCurrentWebApplicationContext();
mybean sBean = (mybean) ctx.getBean("sampleBean");
제목 | 글쓴이 | 날짜 | 조회 |
---|---|---|---|
2003-09-20 |
11732 |
||
2003-09-20 |
11275 |
||
2003-09-20 |
20336 |
||
지구인 |
2010-08-27 |
19200 |
|
지구인 |
2009-09-07 |
13490 |
|
2010-01-29 |
15481 |
||
2004-10-07 |
16592 |
||
2014-01-11 |
2442 |
||
2014-01-07 |
2598 |
||
2014-01-07 |
2384 |
||
2014-01-07 |
2052 |
||
2960 [공개소스] 그누보드 4.36.27 |
2014-01-07 |
1794 |
|
2959 [공개소스] 그누보드 4.36.26 |
2014-01-07 |
1613 |
|
2958 [공개소스] 그누보드 4.36.25 |
2014-01-07 |
1179 |
|
즐거운개굴 |
2013-09-29 |
3003 |
|
2013-09-03 |
4911 |
||
2955 [웹 프로그래밍] ajax 특수문자 |
2013-08-29 |
5372 |
|
2013-08-26 |
4794 |
||
2013-08-25 |
3638 |
||
2013-08-24 |
4167 |
||
2013-08-23 |
4324 |
||
2013-08-23 |
3598 |
||
2013-08-22 |
1892 |
||
2948 [웹 프로그래밍] log4j |
2013-08-10 |
1626 |
|
2013-08-05 |
2155 |
||
2946 [웹 프로그래밍] Spring 기초 |
2013-08-05 |
2094 |
|
2013-07-30 |
1472 |
||
2013-07-23 |
1945 |