JSP-将数组数据从Java获取到JSP中 [英] JSP- getting array data into jsp from java

查看:416
本文介绍了JSP-将数组数据从Java获取到JSP中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须显示从DB到JSP的数据.我正在使用Spring MVC.我已经在Java的List中存储了数据.现在,我需要在JSP中访问此列表,并以表格形式显示它.

I have to display data fetched from DB to JSP. I am using spring MVC. I have stored data in List in java. Now i need to access this list in JSP and display it in tabular form.

数据需要以列表形式从列表和VO表示,列名称和行名称来自列表,以及对象的行/列的相应值. 例如

Data needs to represented in tabular form from List and VO, column names and row names coming from List and corresponding values for row/column from object. e.g

         Column1  Column2  Column3   Column4
Row1       A         B         C       D
Row2       E         F         G       H

如何通过Java在jsp中传递此列表和对象.

How can i pass this List and Object in jsp from java.

谢谢

推荐答案

  • 在servlet上处理它并将其存储在StringList<List<String>>

    将其设置为请求属性,将请求转发给jsp.

    Set it as attribute to request, forward request to jsp.

    使用JSTL表示数据.使用<c:forEach>

    on jsp use JSTL to represent data. using <c:forEach>

    这篇关于JSP-将数组数据从Java获取到JSP中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆