<%
String userId=userBean.getUserId();
String password=userBean.getPassword();
Connection conn=null;
try
{
conn=DBConnection.getConnection();
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select USER_ID from T_USER where USER_ID='"+userId+"' and PASSWORD='"+password+"'");
if(rs.next()){
%>
<jsp:forward page="welcome.jsp">
</jsp:forward>
<%
}else{
%>
<jsp:forward page="fail.jsp">
</jsp:forward>
<%
} }catch(SQLException e){
e.printStackTrace();
}finally{
try{
if(conn!=null)
{
conn.close();
}
}catch(SQLException e){
e.printStackTrace();
}
}
以上是一个查询代码,<jsp:forward>标签执行以后,finally中的代码会执行吗,还是说直接跳过不执行了?谢谢各位指教
String userId=userBean.getUserId();
String password=userBean.getPassword();
Connection conn=null;
try
{
conn=DBConnection.getConnection();
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select USER_ID from T_USER where USER_ID='"+userId+"' and PASSWORD='"+password+"'");
if(rs.next()){
%>
<jsp:forward page="welcome.jsp">
</jsp:forward>
<%
}else{
%>
<jsp:forward page="fail.jsp">
</jsp:forward>
<%
} }catch(SQLException e){
e.printStackTrace();
}finally{
try{
if(conn!=null)
{
conn.close();
}
}catch(SQLException e){
e.printStackTrace();
}
}
以上是一个查询代码,<jsp:forward>标签执行以后,finally中的代码会执行吗,还是说直接跳过不执行了?谢谢各位指教
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货