使用javabeans显示arraylist对象

使用javabeans显示arraylist对象,java,arraylist,javabeans,Java,Arraylist,Javabeans,我正在制作一个webscraping应用程序,所以我不使用任何数据库,只使用javabeans来存储数据和显示xhtml页面,现在我有一个arraylist对象,其中每个对象都有我需要在xhtml页面中显示的数据,但我不知道如何显示。 我知道jsp可以使用jstl,但几天前我听说现在几乎没有人使用jsp,。。。所以我不想在这个项目中使用它 爪哇豆 @ManagedBean(name = "login") @SessionScoped public class Login im

我正在制作一个webscraping应用程序,所以我不使用任何数据库,只使用javabeans来存储数据和显示xhtml页面,现在我有一个arraylist对象,其中每个对象都有我需要在xhtml页面中显示的数据,但我不知道如何显示。 我知道jsp可以使用jstl,但几天前我听说现在几乎没有人使用jsp,。。。所以我不想在这个项目中使用它

爪哇豆

@ManagedBean(name = "login")
@SessionScoped
public class Login implements Serializable{
    private boolean isLoged=false; 
    PortalUDB portaludb;
    Estudiante estudiante; // This is the object tha has the array list
类,该类包含两个arraylist对象

public final class Estudiante{
    private Document document;
    private int uv_carrera;
    private int uv_actuales;
    private final Connection.Response loginForm;
    public List<MateriaPensum> materia_pensum = new ArrayList<>();
    public List<MateriaExpediente> materia_expediente = new ArrayList<>();

可能是因为我使用了getter和setter方法?

如果你知道
Javascript/JQuery
你可以做到。只需将数据列表以JSON字符串格式发送给客户端即可。在客户端,从响应读取列表数据,然后使用循环迭代列表来填充列表(为此,您可以通过ajax请求从客户端获取数据)

为此,为要填充数据的xhtml区域设置父级类/Id,并将其用作参考

我知道这是一个通用的解决方案(但我希望它会有所帮助),但如果您尝试一种特定的方式并告诉我们您面临的问题,它将帮助我们提供更多帮助。如果您使用的是
Spring-MVC
Spring-Boot
,那么您可以使用。我猜您正在将
Estudiante
bean作为
Estudiante
属性传递给请求范围。因此,为了在html中循环使用
materiala\u pensum
列表:

<p th:each="materiaPensum : ${estudiante}" th:text="${materiaPensum.name}"><p/>

public class MateriaExpediente extends MateriaPensum{
    int anio;
    String ciclo;
    String asignatura;
    String matricula;
    float nota;
    String resultado;
<p th:each="materiaPensum : ${estudiante}" th:text="${materiaPensum.name}"><p/>