저는 봄 mvc, maven 및 tomcat을 처음 사용합니다. 나는 bean을 정의한 컨트롤러를 작성했다. 이제 broswer에 url을 입력하면 localhost : 8080/hello.htm 내 컨트롤러가 호출되고이 URL을 누를 때 다시 호출됩니다. 봄 MVC maven 컨트롤러가 두 번 호출되었습니다.
<bean name="/hello.htm" class="com.paytm.controller.InventoryController">
<property name="jdbcProductDao">
<bean class="com.paytm.repository.JdbcProductDao">
<constructor-arg ref="dataSource"></constructor-arg>
</bean>
</property>
</bean>
그리고 컨트롤러 제품이 DB에 두 번 저장 한 결과
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Product product = new Product();
product.setPrice(23.45);
product.setDescription("Test Product");
this.jdbcProductDao.saveProduct(product);
...
}
에서 예. 내 쿼리에서 URL을 입력 할 때 컨트롤러가 호출되는 이유는 무엇입니까?
브라우저 캐시를 삭제 한 후 다시 시도하십시오. –
어느 봄 버전을 사용하고 있습니까? –
당신은'jdbcProductDao.saveProduct'의 코드를 공유 할 수 있습니까? –