URL参数值为动态变化时定义规则及获取动态值方法
其中nameUrl为URL请求路径中输入的变量值
@Controller
@RequestMapping(value="/{nameUrl}/coupon" ,produces="text/plain;charset=UTF-8")
public class CouponController extends BaseController{
private static final Logger log = Logger.getLogger(CouponController.class);
@Autowired
private ISearchCategoryService searchCategoryService;
@Autowired
private ICouponSearchService couponSearchService;
/**
* @param request
* @param response
* @return
*/
@RequestMapping("/queryCoupon")
public String searchCategory(@PathVariable String nameUrl,HttpServletRequest request,HttpServletResponse response) throws Exception{
try {
if(StringUtils.isNotBlank(nameUrl)){
request.setAttribute("guanName", nameUrl);
}
} catch(Exception e){
log.error(RequestThreadLocal.getTimer() + " error", e);
}
return "/coupon/guanCouponList";
}
}