<!
<bean class=
<!
<bean class=
這兩句是注入開啟映射的類
在spring
<mvc:annotation
同樣可以達到以上的結果
package ntroller
import org
import org
import org
import org
@Controller
public class HelloAnnotationController {
@RequestMapping(value=
public ModelAndView addUser(){
return new ModelAndView(
}
@RequestMapping(value=
public ModelAndView delUser(){
return new ModelAndView(
}
}
這裡面也有很多可以優化的
(
(
(
最後controller的代碼可以修改為
package ntroller
import javax
import org
import org
import org
import org
@Controller
@RequestMapping(
public class HelloAnnotationController
@RequestMapping(
public String addUser(HttpServletRequest request){
request
return
}
@RequestMapping(
public String delUser(HttpServletRequest request){
request
return
}
}
From:http://tw.wingwit.com/Article/program/Java/ky/201311/11161.html