Home > Web Front-end > JS Tutorial > JSTL tag library implements loop output of values ​​​​in Map

JSTL tag library implements loop output of values ​​​​in Map

零到壹度
Release: 2018-03-26 16:03:28
Original
1745 people have browsed it

This time I will bring you the JSTL tag library to realize the loop output of the value in the Map, which is mainly reflected in the form of code. Since the EL expression does not support the loop output of the value in the Map, it is necessary to If you loop through the Map, you must use JSTL. The following is a practical case, let's take a look.

This is the action corresponding to the Map

public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
   throws Exception {   Map map = new HashMap();   map.put("k1", "冯江红,你可笑了");   map.put("k2", "想不到你也有今天");   map.put("k3", "这就是苦的滋味,尝到了吗");

   request.setAttribute("maps", map);  return mapping.findForward("success");
 }
Copy after login

You can find it on the page Take it out like this

 <li>利用JSTL循环的方式全出Map中的值</li><br>
  <c:forEach items="${maps}" var="map">
   Map键:${map.key }<br>
   Map值:${map.value }<br>

  </c:forEach>
Copy after login

Related recommendations:

Jstl tag loops to output the data in the Map

Java loop traversal output map method

How to output the value in Map

The above is the detailed content of JSTL tag library implements loop output of values ​​​​in Map. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template