I have the following request handler in which I pass the Map to jsp using the addTeamstoModelForSelecting(teamsForSelect, teams, model) method addTeamstoModelForSelecting(teamsForSelect, teams, model) .
@RequestMapping(value = "/{seriesGameName}", method = RequestMethod.GET) public String getTeamInfoGet(@PathVariable("seriesGameName") String seriesGameName, Model model) throws SQLException, ClassNotFoundException { Games games = seriesGamesRepository.getSeriesGames(seriesGameName); model.addAttribute("games", games); ... ArrayList<Team> teams = seriesGamesRepository.getTeamWhenHasNotInTeamsList(seriesGameName); addTeamstoModelForSelecting("teamsForSelect", teams, model); model.addAttribute("selectingTeam", new Team()); return "pages/seriesGames/seriesGamesNotStart"; ... } The method itself:
private void addTeamstoModelForSelecting(String tagName, ArrayList<Team> teams, Model model) { Map<String,String> teamsMap = new LinkedHashMap<String,String>(); for(Team t : teams){ teamsMap.put(""+t.getId(), t.getId()+": "+t.getName()); } model.addAttribute(tagName, teamsMap); } I don't need to know the size of this Map in jsp.
I tried to do this:
<c:if test="${teamsForSelect.size > 0}"> but the value of ${teamsForSelect.size} does not return anything.
How can I find out the size of this Map?