这是我的.jsp文件
<form action="/loungeHotel/addressValidation" method="post" id="form1">
<div class="row">
<input type="text" name="emailId" value="${studentData.address.emailId}" class="input">
</div>
</form>
<c:set var="totalBasePrice" value="${0}"/>
<c:forEach items="${listOfProducts}" var="productData">
<c:set var="basePrice" value="${productData.basePrice*productData.quantity}"/>
<c:set var="totalBasePrice" value="${basePrice + totalBasePrice}"/>
</c:forEach>
<li>Total Price :${totalBasePrice}</li>
我想将$ {totalBasePrice}值传递给我的java文件
这是我的java类
@RequestMapping(value = "/addressValidation", method = RequestMethod.POST)
private String addressValidation(HttpSession httpSession ,final Model model){
System.out.println("here i want to print the value of totalBasePrice");
return "CheckOutPage";
}
我尝试了什么?
<form action="/loungeHotel/addressValidation" method="post" id="form1">
<div class="row">
<input type="text" name="emailId" value="${studentData.address.emailId}" class="input">
</div>
</form>
<c:set var="totalBasePrice" value="${0}"/>
<c:forEach items="${listOfProducts}" var="productData">
<c:set var="basePrice" value="${productData.basePrice*productData.quantity}"/>
<c:set var="totalBasePrice" value="${basePrice + totalBasePrice}"/>
</c:forEach>
<li>Total Price :${totalBasePrice}</li>
<%
session.setAttribute("base","${totalBasePrice}");
%>
和java
@RequestMapping(value = "/addressValidation", method = RequestMethod.POST)
private String addressValidation(HttpSession httpSession ,final Model model){
System.out.println(httpSession.getAttribute("base"));
return "CheckOutPage";
}
****并打印“$ {totalBasePrice}”****