zoukankan      html  css  js  c++  java
  • 大二下学期学习进度(十六)

    编程时长:14h

    代码行数:760行

    发表博客篇数:3

    所学知识点:

    1.之前做WEB项目的时候显示内容一直用的当初学长的代码思路,将实体放进LIST集合,存进session,在JSP页面中用foreach来循环遍历出来,但是由于调整TOMCAT将jstl包搞坏,严重: Servlet.service() for servlet [jsp] in context with path [/图书管理系统] threw exception [The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application] with root cause
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application一直出现这样的报错,查询百度了很长一段时间还未解决,于是通过结对开发我学到一个新的显示内容的方法,

    public ResultSet getAllRs(){
       		String sql="SELECT * from photo1 ORDER BY xuhao desc";
       		Connection conn = db.getConn();
       		ResultSet rs = null;
       		try{
    			 Statement state = conn.createStatement();
    			 rs=state.executeQuery(sql);
    		}
    		catch(SQLException e){
    			e.printStackTrace();
    			}
    		return rs;
    	}
    

      通过返回一个ResulSet结果集,在jsp页面直接输出结果

     <%
          
            ResultSet rs=dao.getAllRs();
            if(rs==null){
          %>
          <tr align="center" valign="middle"><td colspan="4">没有记录显示!</td>
          </tr>
          <%
            }
            else{
            	 if(rs.next()){
          %>
          <tr align="center" valign="middle" height="22">
            <td>222222</td>  	
            <td><%=rs.getString("id") %></td>  		 
            <td><img src="upload<%=rs.getString("name") %>" width="150px";height="100px"></td>                 	
          </tr>
          <%
            	}
            	 
    

     

  • 相关阅读:
    DotNetCore + Sonar + Coverlet 代码覆盖率检查
    Docker + Sonarqube 环境搭建
    使用cmd进行tfs的签入
    Swashbuckle.AspNetCore(v2.5.0)使用小记
    Ocelot(v7.0.6)使用小记
    layui.formSelects.render(); 需要先执行
    .net core编译时设置不自动生成“netcoreapp3.0”目录
    C# List引用类型的克隆
    HTTP Error 502.5
    GPS服务端(上)-Socket服务端(golang)
  • 原文地址:https://www.cnblogs.com/zjl-0217/p/11069803.html
Copyright © 2011-2022 走看看