짤방 셀렉트 옵션들을 디비에서 불러와서 항목으로 넣었는데

프레임워크는 스프링이고

코드는 대충 이거고



@Controller

public class greetingController {
        
        Resource resource = new ClassPathResource(\"applicationContext.xml\");
        BeanFactory beanFactory = new XmlBeanFactory(resource);
        
        @RequestMapping(value=\"/index.do\", method=RequestMethod.GET)
        public String hello(BrandCommand command) {
                        
                return \"index\";
                
        }
        
        @ModelAttribute(\"products\")
        protected ProductName product_list() throws Exception{
                
                IBatisProductNameDao articleService = (IBatisProductNameDao) beanFactory
                                .getBean(\"ProductNameDao\");
                ProductName rs = articleService.findProductName(1);
                System.out.println(rs.getProduct_name());
                return rs;
                        }
        
        @ModelAttribute(\"brandNames\")
        protected List<String> brand_list() throws Exception{
                List<String> brandNames = new ArrayList<String>();
                IBatisBrandNameDao articleService = (IBatisBrandNameDao) beanFactory
                                .getBean(\"BrandNameDao\");
                for(int i=1;i<8;i++){
                        BrandName rs = articleService.findBrandName(i);
                        brandNames.add(rs.getBrand_name());
                        
                }        
                return brandNames;
                        }

        @RequestMapping(value=\"/index.do\", method=RequestMethod.POST)
        public String go() {
                return \"index\";
        }
        
        
        }

내가 ibatis용 DAO객체로 db쿼리날릴때 매번

Resource resource = new ClassPathResource(\"applicationContext.xml\");
        BeanFactory beanFactory = new XmlBeanFactory(resource);

로 만든 beanFactory로 객체를 맹그러서 받아오는데 이거 뻘짓이냐? ㅋㅋㅋ