I would like to pass 4 parameter from view. It looks like this-
<button>
<a href="/generateDetails/${fromDate}/${toDate}/${shopList.shopId}/${billStatus}" target="_blank" title="Download">Download</a>
</button>
In controller
@RequestMapping(value = "generateDetails/{what to do here}", method = RequestMethod.GET)
private void generateDetails(
HttpServletRequest request, HttpServletResponse response,
@PathVariable("what to do here") String something) {
//Codes for generate pdf report
}
Please provide me some details about corrections in View and Controller end.
I have tried:
In View End-
<button>
<a href="/generateDetails/${fromDate}/${toDate}/${shopList.shopId}/${billStatus}" target="_blank" title="Download">Download</a>
</button>
In Controller-
@RequestMapping(value = "generateDetails/{fromDate}/{toDate}/{shopId}/{billStatus}", method = RequestMethod.GET)
private void generateDetails(
HttpServletRequest request, HttpServletResponse response,
@PathVariable("fromDate") String fDate,
@PathVariable("toDate") String tDate,
@PathVariable("shopId") String shopId,
@PathVariable("billStatus") String bStatus) {
//Codes for generate pdf report
}
In view end, after clicking the button it is not working. If i pass single parameter then the button works and controller gets the value.
<input>tag within the<form>tag where i usedformactionattribute to redirect to the URL in View end. And in Controller end i used@ModelAttributeannotation to get each of the inputted form data. It's working just fine :)