Displaying array values in jsp

后端 未结 3 1465
感动是毒
感动是毒 2021-01-14 17:34

I have following two array in my code

List centralityList = (List) request
            .getAttribute(\"centralityList\");

List&l         


        
3条回答
  •  情深已故
    2021-01-14 18:05

    try this code

        <%
       List centralityList = (List) request
                .getAttribute("centralityList");
    
       List labelList = (List) request
                .getAttribute("labelList");
    
        String myString="";
    %>
    
    <% for(int i = 0; i < labelList.size(); i++) { out.println((String)labelList.get(i)); } %> <% for(int i = 0; i < centralityList.size(); i++) { out.println((double)centralityList.get(i)); } %>

    You can achieve this eaisly by using JSTL which is even more easy and far better way but as in your code I didn't find any evidence of using JSTL , so this is the way for now

提交回复
热议问题