Framework/spring
[spring] spring에 올라와있는 객체들 jsp에서 사용방법
jeeyong
2008. 10. 2. 13:48
<%
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext( application );
ExampleDAO exampleDAO = (ExampleDAO)ctx.getBean("exampleDAO");
Example example = exampleDAO.get( Integer.parseInt( request.getParameter("id") ) );
%>
<html>
<head>
<style type="text/css">
BODY {
margin-left:0px;
margin-top:0px;
margin-right: 0px;
margin-bottom:0px;
}
</style>
</head>
<body style="margin:0px; padding:0px;">
<%= example.getContent() %>
</body>
</html>
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext( application );
ExampleDAO exampleDAO = (ExampleDAO)ctx.getBean("exampleDAO");
Example example = exampleDAO.get( Integer.parseInt( request.getParameter("id") ) );
%>
<html>
<head>
<style type="text/css">
BODY {
margin-left:0px;
margin-top:0px;
margin-right: 0px;
margin-bottom:0px;
}
</style>
</head>
<body style="margin:0px; padding:0px;">
<%= example.getContent() %>
</body>
</html>
위와같은 방법으로 DAO객체를 불러와 jsp에서 바로 사용가능하다.