Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在同一注册页面JSP和Servlet中加载数据列表_Java_Jsp_Servlets - Fatal编程技术网

Java 在同一注册页面JSP和Servlet中加载数据列表

Java 在同一注册页面JSP和Servlet中加载数据列表,java,jsp,servlets,Java,Jsp,Servlets,我在同一页中有一个注册表和表,但我的表仅在提交新注册表时加载数据。打开页面时如何加载表格?我正在使用JSP和Servlet。我试着在这里搜索,但我没有找到我需要的 index.jsp <table class="table table-striped table-bordered"> <thead class="thead-dark text-center"> <tr> <t

我在同一页中有一个注册表和表,但我的表仅在提交新注册表时加载数据。打开页面时如何加载表格?我正在使用JSP和Servlet。我试着在这里搜索,但我没有找到我需要的

index.jsp

    <table class="table table-striped table-bordered">
        <thead class="thead-dark text-center">
            <tr>
                <th scope="col">CÓDIGO</th>
                <th scope="col">DATA</th>
                <th scope="col">QUANTIDADE</th>
                <th scope="col">VALOR</th>
                <th scope="col">VOLUME</th>
            </tr>
        </thead>

        <tbody>
            <c:forEach items="${investimentos}" var="inv">
                <tr>
                    <td><c:out value="${inv.codigo}"></c:out></td>
                    <td><c:out value="${inv.data}"></c:out></td>
                    <td><c:out value="${inv.quantidade}"></c:out></td>
                    <td>R$<c:out value="${inv.valor}"></c:out></td>
                    <td>R$<c:out value="${inv.valor * inv.quantidade}"></c:out></td>
                </tr>
            </c:forEach>
        </tbody>
    </table>

如果以
/index.jsp
开头,则无法查看该表。您需要从
/registrarcao
开始,然后进入
doGet
方法,您的表将被加载

更改欢迎页面

<welcome-file-list>
    <welcome-file>index.page</welcome-file>
</welcome-file-list>

index.page

如果从/index.jsp开始,则无法查看表格提供您已经尝试过的步骤。具体问题是什么?堆栈溢出不是免费的代码编写服务。请参阅:,。当我改为注册时工作了
<welcome-file-list>
    <welcome-file>index.page</welcome-file>
</welcome-file-list>