Home Spring框架
Spring框架
取消

Spring框架

大型框架

ContextPath 上下文地址

local:8080/abc/xyz/a.jsp

a.jsp 的ContextPath不知道是abc还是 /(根)

 

index.jsp里面可以使用response.sendRedriect令客户端不用访问多个url

 

sendRedriect    是发送两个request,url发生变化

jsp:forward    是发送一个request,url可以不发生变化

 

servletContextListener:    ContextInitization;    ContextDestroy

 

view接口   String getContentType();    void render(Map<String, ?>)]n

                

支持xml,json和自己定义的

@Controller
public class DownloadController{
    @RequestMapping("/download")
    public String d(HttpServletReequest request){
        String fileid = "1234";
        // jdbc编程
        // select选项
        String filename = "spring.zip";
        
    }
}

public class DownloadView implements View{
    public String getContentType(){
        return ...
    }
}

import java.sql.*
public class TestJdbc{
    public void test(){
        Class.forName("com.mysql.jdbc.Driver");
        Connection con=
        DriverManager.getConnectioin("jdbc:mysql://localhost","java", "java1234")
        PreparedStatement pstmt = 
            con.prepartStatement("select* from student where j2ee<? and gender=?");
        pstmt.setInt(1, 60);
        pstmt.setInt(2, 1);
        ResultSet rs = pstmt.executeQuery();
    }
}

import javax.sql.*
中才有
DataSource ds = new ...DataSource()
ServletContextListener
// 配置链接池
public void contextInitialized(ServletContextEvent sce){
    DataSource ds = ...;
    // 考
    sec.getServletContext().setAttribute("ds", ds);
    // 考
    Connection con = ds.getConnection();
    con.close();
}

ServletContextListener

HttpSessionEvent

 

SpringJdbc是对 jdbc 的封装

query类

update类

 

JSTL通用标签

prefix = "c"%>

<%c:...

 

流程控制标签

<c:if>标记

<c:when>标记<=> switch case

 

 

 

 

 

 

 

 

该博客文章由作者通过 CC BY 4.0进行授权。