Spring MVC adelante agregando valores de parámetros de solicitud separados por comas cuando tenemos el mismo nombre de parámetro para topRequest y solicitud de reenvío
@RequestMapping(path = "/details") public ModelAndView details(@ModelAttribute final DetailsForm detailsForm){ //DetailsForm contain a parameter called destinationId with value 1234 final ModelAndView mav = new ModelAndView(); //Some logic to get targeted destinationId (7890) using destinationId (1234) from detailForm mav.setViewName("forward:/search?destinationId=7890"); return mav; } @RequestMapping(path = "/search") public ModelAndView details(@ModelAttribute final SearchForm searchForm){ //Here I tried to get destinationId from model-attribute searchForm final Integer destinationId = searchForm.getDestinationId(); //Then it returned me 1234,7890 }
¿Alguien puede ayudarme a resolver esto? Quiero obtener solo 7890.
Yo también estoy interesado en la respuesta. También me encontré con este problema, lo pirateé agregando un método:
private String getLastPartFromFormValue(final String value) { if (value == null) return null; String[] parts = value.split(","); return parts[parts.length -1]; }