我在 Spring MVC 上工作。我如何从视图中向控制器请求并显示该数据、哪些标签或其他技术?
我尝试这样的视图(它在循环内)
<a href="/admin/history/getTotalprice/${order.orderId}/${restaurantSession.restaurantName}"/>
这是我的控制器,我想以双倍的价格返回总价
@RequestMapping(value = "/admin/history/getTotalprice/{orderID}/{restaurantUserName}")
public double getTotalPrice(@PathVariable("orderID")Integer orderID,@PathVariable("restaurantUserName")String restaurantUserName){
double totalprice=0;
for(ProductInCart productInCart: orderService.getProductByRestaurantUserNameAndOrderId(restaurantUserName,orderID)){
totalprice = totalprice + ((productInCart.getProduct().getProductPrice()) * (productInCart.getAmount()));
}
return totalprice;
}
谢谢大家帮助我
编辑
对不起,可能是我问的不好。我找出了请求控制器的标签,并在同一页面中显示从控制器发送的数据。因为数据是特定的,例如
/admin/history/getTotalprice/1/A. 总价500。
/admin/history/getTotalprice/2/A. 总价1000。