我正在做一个网络应用。
我想在一个jsp中使用另一个jsp中的输入值。
我在做什么错?谢谢。
错误:https://imgur.com/a/WakjS74
HTTP Status 500 – Internal Server Error
Type Exception Report
Message An exception occurred processing [/jsp/editar.jsp] at line [43]
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: An exception occurred processing [/jsp/editar.jsp] at line [43]
40: <th>TIPO DE PÓLEN</th>
41: </tr>
42:
43: <% for(int i = 0; i < dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).size(); i ++){
44: %>
45: <tr>
46: <td><%out.print(dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).get(i).getIdpollocal()); %></td>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:625)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:514)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Integer.java:542)
java.lang.Integer.parseInt(Integer.java:615)
org.apache.jsp.jsp.editar_jsp._jspService(editar_jsp.java:174)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.
index.jsp:
<form action="loginServlet">
<table style="font-family: Corbel">
<tr>
<td><label for="username">
username</label></td>
<td><input type="number" name="username"></td>
</tr>
.....
editar.jsp:
<jsp:include page="index.jsp" >
<jsp:param name="username" value=""/>
</jsp:include>
....
<% for(int i = 0; i < dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).size(); i ++){
%>
<tr>
<td><%out.print(dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).get(i).getIdpollocal()); %></td>
<td><%out.print(dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).get(i).getData()); %></td>
<td><%out.print(dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).get(i).getNome()); %></td>
<td><% out.print(dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).get(i).getLat()); %></td>
<td><% out.print(dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).get(i).getLongi()); %></td>
<td><% out.print(dados.getEntradasUser(Integer.parseInt(request.getParameter("username"))).get(i).getDescri()); %></td>
<%
}
%>
</tr>
(其中dados.getEntradasUser(iduser)接收一个int仅搜索该用户的内容,iduser是用户的用户名)