代码片断如下:
我想通过循环动态控制图像的显示次数,每次显示两幅图像,并传递不同的值。
现在的问题是,若每次控制显示的是一幅图像(2部分删除),则正常。控制两幅图像时会报错:
javax.servlet.ServletException: No data found
java.sql.SQLException: No data found
我觉得很奇怪,请教各位高手!<%while(rs.next()){%>
/////////////////1///////////////
<%
out.print("<a href=\"ticketbook1.jsp?booktype&flightID1=" + rs.getInt("FlightID") + "&SeatType=1\">");
%><img src="images/order_seat.gif" width="96" height="21" border="0"></a></td>
////////////////2////////////////
<%
out.print("<a href=\"ticketbook1.jsp?booktype&flightID1=" + rs.getInt("FlightID") + "&SeatType=2\">");
%><img src="images/order_seat.gif" width="96" height="21" border="0"></a></td><%
}
%>
我想通过循环动态控制图像的显示次数,每次显示两幅图像,并传递不同的值。
现在的问题是,若每次控制显示的是一幅图像(2部分删除),则正常。控制两幅图像时会报错:
javax.servlet.ServletException: No data found
java.sql.SQLException: No data found
我觉得很奇怪,请教各位高手!<%while(rs.next()){%>
/////////////////1///////////////
<%
out.print("<a href=\"ticketbook1.jsp?booktype&flightID1=" + rs.getInt("FlightID") + "&SeatType=1\">");
%><img src="images/order_seat.gif" width="96" height="21" border="0"></a></td>
////////////////2////////////////
<%
out.print("<a href=\"ticketbook1.jsp?booktype&flightID1=" + rs.getInt("FlightID") + "&SeatType=2\">");
%><img src="images/order_seat.gif" width="96" height="21" border="0"></a></td><%
}
%>
你这样修改代码看看:
<%while(rs.next()){%>
/////////////////1///////////////
<%
int flightid=rs.getInt("FlightID");
out.print("<a href=\"ticketbook1.jsp?booktype&flightID1=" + flightid + "&SeatType=1\">");
%><img src="images/order_seat.gif" width="96" height="21" border="0"></a></td>
////////////////2////////////////
<%
out.print("<a href=\"ticketbook1.jsp?booktype&flightID1=" + flightid + "&SeatType=2\">");
%><img src="images/order_seat.gif" width="96" height="21" border="0"></a></td><%
}
%>通过了记得给分哟.