java学习第三十一天之servlet

1.response 代表响应, 可以理解为一个空的箱子,我们在里面填入要发送到浏览器的内容. 服务器会把这些内容组装成http响应.

    响应首行  协议/版本号  状态码  状态码描述
        添加状态码 和 描述
        3
        void setStatus(int sc)  只设置状态码
        void setStatus(int sc, String sm)   设置状态码和描述
        void sendError(int sc) 只设置状态码,错误的
        void sendError(int sc, String msg)  设置状态码和描述
    响应头
        添加响应头
            void setHeader(String name, String value) 设置响应头,如果key一样会覆盖
                setIntHeader(String name, int value) 
                setDateHeader(String name, long date) 

            void addHeader(String name, String value) 设置响应头,无论如何都新增.
                 void addIntHeader(String name, int value) 
                 void addDateHeader(String name, long date)  
    响应空行
    响应正文
        发送字节流
            getOutputStream
        发送字符流
            getWriter

//==========================================================================================================
应用.

例一: 手动向浏览器发送404

例二: 重定向 

例三: Refresh头.刷新 

例四: 发送字节流. 发送中文.

例五: 发送字符流. 发送中文.

字符流和字节流要注意的一个问题:
    字节流和字符流一定不能同时使用.

例六:使用字节流发送图片

例七:使用字节流发送文件(文件下载)

//=============================================================================================================
request对象   
    一.封装了浏览器发送来的请求信息.


    请求首行  请求方式 请求路径  协议/版本号
        request.getMethod(): GET
        request.getRequestURI(): /Day08-request/AServlet
        request.getServletPath(): /AServlet
        request.getContextPath(): /Day08-request
        request.getScheme(): http
    请求头
//--原始方式获得请求头
        String getHeader(String name)  
        long getDateHeader(String name) 
        int getIntHeader(String name)
        Enumeration getHeaders(String name)
        Enumeration getHeaderNames() 

//---javaee封装好的方法.
        request.getContentLength(): -1
        request.getContentType(): null
        request.getLocale(): zh_CN
        request.getQueryString(): name=tom&age=18
        request.getRequestURL(): http://localhost:8080/Day08-request/AServlet
        request.getRemoteAddr(): 0:0:0:0:0:0:0:1
        request.getRemoteHost(): 0:0:0:0:0:0:0:1
        request.getRemotePort(): 52074
        request.getServerName(): localhost
        request.getServerPort(): 8080
    请求空行
    请求正文 表单传送过来的键值对

    获得表单提交的参数.
    1.GET  http://localhost:8080/Day08-request/AServlet?name=tom&age=18
        乱码:只要确保编码和解码一致,就绝对没有问题.
            1.浏览器负责编码.浏览器使用的码表就是表单所在页面的码表.

            2.服务器负责解码.服务器默认使用ISO-8859-1解码. 如下配置的URIEncoding来决定解码码表
                 <Connector port="8080" protocol="HTTP/1.1"  URIEncoding="UTF-8"
                    connectionTimeout="20000" 
                redirectPort="8443" />
            如上配置会影响整个服务器不推荐.
                我们使用如下代码解决:
                        //获得参数
                        String name = request.getParameter("name");
                        //因为服务器使用了错误的码表,那么我们按照错误的码表原路返回
                        byte[] nameByte = name.getBytes("ISO-8859-1");
                        //用正确的码表重新解码
                        String newName = new String(nameByte,"UTF-8");

                        System.out.println("解决之后的:"+newName);


    2.POST
        因为Post解码是在第一次调用getParameter之前,那么解决乱码只需要在调用该方法之前设置编码:
            request.setCharacterEncoding("UTF-8");

            String name = request.getParameter("name");

            System.out.println(name);

涉及到获得表单参数的方法还有哪些呢?
        String getParameter 根据键获得值
        Map getParameterMap()  获得服务器保存表单参数的容器. 就是map<String,String[]>. 泛型: habit=chi&habit=shui&habit=la
        Enumeration getParameterNames()  获得提交的所有键
        String[] getParameterValues(String name)  根据键获得值. 获得一键对应多个值的情况的.


//---------------------------------------------------------------------------------------------------------------------
2.request的请求转发和包含功能.
    转发:
        一个Servlet处理完毕交给下面的servlet(JSP)继续处理.
    作用: 
        在现实开发中,没有servlet转发给servlet的情况.都是由servlet转发给JSP.
        这样可以达到分工的作用:
            servlet: 比较适合处理业务.
            JSP: 比较适合显示功能
    注意问题:
            //servlet中不要做 输出正文的动作,没有结果的
            //如果放到前面会出现乱码.
            //但是响应头是可以设置的.

    包含:
        两个servlet(jsp)共同向浏览器输出内容.
    作用:
        在现实开发中,多个页面含有相同的内容,我们把相同的内容抽取到一个jsp中,在需要显示这个段内容的jsp中,包含抽取的jsp.可以达到
        统一管理相同的内容.

3.request域的应用.
    原理:
        在request对象中含有一个map.这个map就是request域.
    作用:
        在将来开发中. 使用请求转发时,servlet处理完数据, 处理结果要交给jsp显示. 可以使用request域将处理结果有servlet带给jsp显示.

    操作:
        1.setAttribute  存入一个键值对
        2.getAttribute  通过键取出值
        3.getAttributeNames 获得域中所有键
        4.removeAttribute 跟据键移除一个键值对        

    request的范围:
        一个request对象对应一个request域(map).
        系统当前有多少个request就有多少request域.

//=================================================================================================================
路径总结:
    路径分为两种情况:
        1.客户端路径 ==> 给浏览器用的路径
            <form action="/Day08-request/AServlet" >
            <a href="/Day08-request/AServlet" >
            <img src="/Day08-request/AServlet" >
            response.sendRedirect("/Day08-request/AServlet")
            Refresh:3;url=/Day08-request/AServlet
        路径写法:
            带"/" :  "/" ==> 相对于 主机.
                例如: 表单所在页面路径为==> http://localhost:8080/Day08-request/login.jsp ==> "/" 代表http://localhost:8080/

            不带"/":(开发中一定不要出现不带"/"的情况).代表从当前目录找.
                例如: 表单所在页面路径为==> http://localhost:8080/Day08-request/info/login.jsp ==> 代表 http://localhost:8080/Day08-request/info/


        2.服务器端路径
            <url-pattern> /AServlet  ==> http://localhost:8080/Day08-request/AServlet
            request.getRequestDispatcher("/AServlet") ==> http://localhost:8080/Day08-request/AServlet
        路径写法:
            "/": 相对于项目.  "/"==>http://localhost:8080/Day08-request/

request&response

1response
代表响应,可以理解为一个空的箱子,我们在 里面填入到要发送浏览器的内容,夫妻会把这些内容组装成http响应
响应首行  协议/版本号 状态码  状态码描述
    添加状态码和描述
        void  setStatus(int sc) 只设置状态码
        void setStatus(int sc,String sm) 设置状态码和描述
        void sendError(int sc)  设置状态码 错误的
        void sendError(int sc,String sm) 设置状态码和描述  错误的
响应头  
 添加响应头
    void setHeader(String name,String value) 设置响应头
    setIntHeader(String name,int value)
    setDateHeader(String name,long date)

    void addHeader(String name,String vale) 设置响应头,无论如何都新增
    void addIntHeader(String name,int value )
    void addDateHeader(String name,long date)
响应空行
响应正文
  发送字符流 getOutputStream
  发送字节流 getWriter
=======================================================================
应用
例一:手动想浏览器发送404
例二:重定向
例三:Refresh头   刷新
例四:发送字节流 发送中文
例五:发送字符流  发送中文

字符流和字节流要注意的一个问题:
    字符流和字节流一定不能同时使用
例六:使用字节流发送图片
例七:使用字节流发送文件(文件下载)
    request对象
        封装了浏览器发送来的信息
package my.servletlearn.demo;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
//      取得之前记录的数字,从application取
        Integer count=(Integer) getServletContext().getAttribute("count");
//      取到了===>不是第一次访问
        if(count!=null){
            resp.getWriter().print("you are the    "+(count++)+"   visitor");
        }else {
            count=1;
            resp.getWriter().print("you're the first Visitor!");
        }
//      没有取到,当前是第一次访问
//      将访问数据输出给浏览器
//      将新的访问数据放回到application域
        getServletContext().setAttribute("count", count);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.apply1;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class BServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        resp.setStatus(404, "找到也不告诉你");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.apply1;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
/*//        重定向
//      返回状态码 为302
        resp.setStatus(302);
//      告诉浏览器去哪儿找新的地址,发送一个响应头:Location:http://www.baidu.com
        resp.setHeader("Location", "http://www.baidu.com");
        resp.setHeader("Location", "AServlet");
        */
//      作用和上面代码的功能相同
        resp.sendRedirect( "AServlet");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.apply1;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
//      解决乱码
        resp.setContentType("text/hml;charset=utf-8;");
//      设置响应头为 Refresh :5  ;url=http://localhost:8080/MyServlet/AServlet    

//      使用字符流发送提示,5秒后跳转
//      resp.setHeader("Refresh", "5;url=http://localhost:8080/MyServlet/AServlet");
        resp.setHeader("Refresh", "5;url=AServlet");

//      resp.getWriter().print("您将在5秒后跳转到AServlet");
        resp.getWriter().print("您将在<span id='one'></span>秒后跳转到AServlet!"+"<script type='text/javaScript'>"
                + "var count=5;"
                + "function fun1(){"
                + "var span=document.getElementById('one');"
                + "span.innerHTML=count;"
                +"count--;"
                + "if(count>0){"
                + "window.setIimeout(fun1,1000);"
                + "}"
                + "}"
                + "fun1();"+"</script>");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.apply1;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class EServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//      获得输出流
        OutputStream oStream=resp.getOutputStream();
//      输出中文
        oStream.write("你好,世界".getBytes("utf-8"));
//      告诉浏览器使用GBK解码====>乱码
//      oStream.write("<meta http-equiv='Content-Type' content='text/html/';charset='utf-8'".getBytes());
//      resp.setHeader("Content-Type", "text/html;charset=gbk");
//      解决乱码
        resp.setHeader("Content-Type", "text/html;charset=utf-8");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.apply1;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class FServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//      控制字符流使用编码格式,往上放,在获得字符流的时候会来取这个编码,如果在取完之后设置,没有效果
        resp.setCharacterEncoding("utf-8");

//      告诉浏览器使用什么编码
        resp.setHeader("Content-Type", "text/html;charset=utf-8");
//      JavaEE提供了一个方法,这个方法同时可做以上两件事
        resp.setContentType("text/html;charset=utf-8");

//      获得字符流
        PrintWriter pWriter=resp.getWriter();
//      pWriter.write("133!");//write 和   print都可以发送到浏览器

//      发送 中文
        pWriter.print("你好,世界!");
//      resp.getOutputStream().print("haha"); 字符流和字节流不能同时使用
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.apply1;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//发送图片
public class GServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//      告诉浏览器  发给您的流是MIME类型
//      resp.setContentType("image/jpeg");
        resp.setContentType("application/java-archive");//如果发送Jar类型  去tomcat的xml文件中搜索类型
//      获得图片的输入流
        InputStream iStream=getServletContext().getResourceAsStream("/WEB-INF/egg.png");

//      通过responsee获得输出字节流
        OutputStream oStream=resp.getOutputStream();

//      两个对接
        byte[] buffer=new byte[1024];
        int len=0;
        while((len=iStream.read(buffer))>0){
            oStream.write(buffer,0,len);
            oStream.flush();
        }
        iStream.close();
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.apply1;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//发送文件
public class HServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//      告诉浏览器  发给您的流是MIME类型

        resp.setContentType("application/java-archive");//如果发送Jar类型  去tomcat的xml文件中搜索类型
        resp.setContentType(getServletContext().getMimeType(".jar"));//Context对象根据后缀名去web.xml查找mime类型

//      告诉浏览器推荐用户使用什么名称下载
        resp.setHeader("Content-Disposition", "attachment;filename=mycode.rar");//mycode.rar推荐使用的下载名称
//      获得图片的输入流
        InputStream iStream=getServletContext().getResourceAsStream("/WEB-INF/demo.rar");

//      通过responsee获得输出字节流
        OutputStream oStream=resp.getOutputStream();

//      两个对接
        byte[] buffer=new byte[1024];
        int len=0;
        while((len=iStream.read(buffer))>0){
            oStream.write(buffer,0,len);
            oStream.flush();
        }
        iStream.close();
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.req_res;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//get解决乱码
public class IServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//      获得表单天傲上来的键值对
        String name=req.getParameter("name");
        String age=req.getParameter("age");
        System.out.println(name+"===="+age);

//      解决乱码
        byte[] nameByte=name.getBytes("ISO-8859-1");
        String newName=new String(nameByte,"utf-8");
        System.out.println("解决之后的加上"+newName);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package my.servletlearn.req_res;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class JServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doGet(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//      解决Post乱码
//      因为post请求中,参数的解码时机是在第一次调用getParameter之前,那么我们要在调用这个放马之前设置解码方法
//      如下就是设置host解码
        req.setCharacterEncoding("utf-8");

        String name=req.getParameter("name");       
        System.out.println(name);
    }

}
package my.servletlearn.req_res;

import java.io.IOException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class KServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//      Map getParameterMap()  获得服务器保存表单参数的容器. 就是map<String,String[]>. 泛型: habit=chi&habit=shui&habit=la
        Map<String, String[]> map=req.getParameterMap();
        for(Entry<String, String[]> en:map.entrySet()){
            String key=en.getKey();
            String[] value=en.getValue();
//                  value=value.getBytes("ISO-8859-1");
            System.out.println(key+"=====>"+Arrays.toString(value));

        }
//              Enumeration getParameterNames()  获得提交的所有键
        Enumeration<String> enumeration=req.getParameterNames();
        while (enumeration.hasMoreElements()) {
            String key = (String) enumeration.nextElement();
            System.out.println("提交上来的键"+key);

        }
//              String[] getParameterValues(String name)  根据键获得值. 获得一键对应多个值的情况的.
        String[] habits=req.getParameterValues("habit");
        System.out.println(Arrays.toString(habits));


//      String habit=req.getParameter("habit"); //只能获取数组中的第一个
//      System.out.println(habit);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package myservletlearn.passmsg;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import my.servletlearn.demo.AServlet;

public class LServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().print("呵呵哒,哼 ~");
        String name=req.getParameter("name");
        String pwd=req.getParameter("password");

        if(name!=null && name.trim().length()>0  && name.equals("blue")
                &&pwd!=null && pwd.trim().length()>0&& pwd.equals("123")){
            System.out.println("sdfsf");
            req.getRequestDispatcher("login/success.jsp").forward(req, resp);//转发器
        /*  可以使用RequestDispatcher
            AServlet aServlet=new AServlet();
            aServlet.init();
            aServlet.service(req, resp);
        */  
        }else {
            req.getRequestDispatcher("login/error.jsp").forward(req, resp);//转发器
        }
//      servlet中不要做输出中文的动作,没有效果的
        resp.getWriter().print("呵呵哒,哼 ~");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//  获得表单提交的用户名和密码
//      判断是否正确 tom 123 才算成功
//      成功==>转发到成功页面
//      失败==>转发到失败页面
        doGet(req, resp);

    }

}
package myservletlearn.passmsg;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=utf-8");
        resp.getWriter().print("这是正文部分<hr>");
        req.getRequestDispatcher("/NServlet").include(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package myservletlearn.passmsg;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class NServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().print("这是页脚部分");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // TODO Auto-generated method stub
        super.doPost(req, resp);
    }

}
package myservletlearn.passmsg;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class OServlet extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//      获得表单提交的用户名和密码
        String name=req.getParameter("name");
        String pwd=req.getParameter("password");
        Map<String, String> error=new HashMap<String, String>();
//      验证
        if(!(name!=null && name.trim().length()>0 && name.equals("blue"))){
            error.put("name","用户名有误");
        }
        if(!(pwd!=null && pwd.trim().length()>0 && pwd.equals("123"))){
//          成功===>成功页面
//          失败===>失败页面
            error.put("pwd","密码有误");
        }
        if (error.size()>0) {
//          将错误信息通过request带到错误页面
            req.setAttribute("error", error);
            req.getRequestDispatcher("/login/error.jsp").forward(req, resp);
        }else {
            req.getRequestDispatcher("/login/success.jsp").forward(req, resp);
        }
    }

}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
完整版:https://download.csdn.net/download/qq_27595745/89522468 【课程大纲】 1-1 什么是java 1-2 认识java语言 1-3 java平台的体系结构 1-4 java SE环境安装和配置 2-1 java程序简介 2-2 计算机中的程序 2-3 java程序 2-4 java类库组织结构和文档 2-5 java虚拟机简介 2-6 java的垃圾回收器 2-7 java上机练习 3-1 java语言基础入门 3-2 数据的分类 3-3 标识符、关键字和常量 3-4 运算符 3-5 表达式 3-6 顺序结构和选择结构 3-7 循环语句 3-8 跳转语句 3-9 MyEclipse工具介绍 3-10 java基础知识章节练习 4-1 一维数组 4-2 数组应用 4-3 多维数组 4-4 排序算法 4-5 增强for循环 4-6 数组和排序算法章节练习 5-0 抽象和封装 5-1 面向过程的设计思想 5-2 面向对象的设计思想 5-3 抽象 5-4 封装 5-5 属性 5-6 方法的定义 5-7 this关键字 5-8 javaBean 5-9 包 package 5-10 抽象和封装章节练习 6-0 继承和多态 6-1 继承 6-2 object类 6-3 多态 6-4 访问修饰符 6-5 static修饰符 6-6 final修饰符 6-7 abstract修饰符 6-8 接口 6-9 继承和多态 章节练习 7-1 面向对象的分析与设计简介 7-2 对象模型建立 7-3 类之间的关系 7-4 软件的可维护与复用设计原则 7-5 面向对象的设计与分析 章节练习 8-1 内部类与包装器 8-2 对象包装器 8-3 装箱和拆箱 8-4 练习题 9-1 常用类介绍 9-2 StringBuffer和String Builder类 9-3 Rintime类的使用 9-4 日期类简介 9-5 java程序国际化的实现 9-6 Random类和Math类 9-7 枚举 9-8 练习题 10-1 java异常处理 10-2 认识异常 10-3 使用try和catch捕获异常 10-4 使用throw和throws引发异常 10-5 finally关键字 10-6 getMessage和printStackTrace方法 10-7 异常分类 10-8 自定义异常类 10-9 练习题 11-1 Java集合框架和泛型机制 11-2 Collection接口 11-3 Set接口实现类 11-4 List接口实现类 11-5 Map接口 11-6 Collections类 11-7 泛型概述 11-8 练习题 12-1 多线程 12-2 线程的生命周期 12-3 线程的调度和优先级 12-4 线程的同步 12-5 集合类的同步问题 12-6 用Timer类调度任务 12-7 练习题 13-1 Java IO 13-2 Java IO原理 13-3 流类的结构 13-4 文件流 13-5 缓冲流 13-6 转换流 13-7 数据流 13-8 打印流 13-9 对象流 13-10 随机存取文件流 13-11 zip文件流 13-12 练习题 14-1 图形用户界面设计 14-2 事件处理机制 14-3 AWT常用组件 14-4 swing简介 14-5 可视化开发swing组件 14-6 声音的播放和处理 14-7 2D图形的绘制 14-8 练习题 15-1 反射 15-2 使用Java反射机制 15-3 反射与动态代理 15-4 练习题 16-1 Java标注 16-2 JDK内置的基本标注类型 16-3 自定义标注类型 16-4 对标注进行标注 16-5 利用反射获取标注信息 16-6 练习题 17-1 顶目实战1-单机版五子棋游戏 17-2 总体设计 17-3 代码实现 17-4 程序的运行与发布 17-5 手动生成可执行JAR文件 17-6 练习题 18-1 Java数据库编程 18-2 JDBC类和接口 18-3 JDBC操作SQL 18-4 JDBC基本示例 18-5 JDBC应用示例 18-6 练习题 19-1 。。。
完整版:https://download.csdn.net/download/qq_27595745/89522468 【课程大纲】 1-1 什么是java 1-2 认识java语言 1-3 java平台的体系结构 1-4 java SE环境安装和配置 2-1 java程序简介 2-2 计算机中的程序 2-3 java程序 2-4 java类库组织结构和文档 2-5 java虚拟机简介 2-6 java的垃圾回收器 2-7 java上机练习 3-1 java语言基础入门 3-2 数据的分类 3-3 标识符、关键字和常量 3-4 运算符 3-5 表达式 3-6 顺序结构和选择结构 3-7 循环语句 3-8 跳转语句 3-9 MyEclipse工具介绍 3-10 java基础知识章节练习 4-1 一维数组 4-2 数组应用 4-3 多维数组 4-4 排序算法 4-5 增强for循环 4-6 数组和排序算法章节练习 5-0 抽象和封装 5-1 面向过程的设计思想 5-2 面向对象的设计思想 5-3 抽象 5-4 封装 5-5 属性 5-6 方法的定义 5-7 this关键字 5-8 javaBean 5-9 包 package 5-10 抽象和封装章节练习 6-0 继承和多态 6-1 继承 6-2 object类 6-3 多态 6-4 访问修饰符 6-5 static修饰符 6-6 final修饰符 6-7 abstract修饰符 6-8 接口 6-9 继承和多态 章节练习 7-1 面向对象的分析与设计简介 7-2 对象模型建立 7-3 类之间的关系 7-4 软件的可维护与复用设计原则 7-5 面向对象的设计与分析 章节练习 8-1 内部类与包装器 8-2 对象包装器 8-3 装箱和拆箱 8-4 练习题 9-1 常用类介绍 9-2 StringBuffer和String Builder类 9-3 Rintime类的使用 9-4 日期类简介 9-5 java程序国际化的实现 9-6 Random类和Math类 9-7 枚举 9-8 练习题 10-1 java异常处理 10-2 认识异常 10-3 使用try和catch捕获异常 10-4 使用throw和throws引发异常 10-5 finally关键字 10-6 getMessage和printStackTrace方法 10-7 异常分类 10-8 自定义异常类 10-9 练习题 11-1 Java集合框架和泛型机制 11-2 Collection接口 11-3 Set接口实现类 11-4 List接口实现类 11-5 Map接口 11-6 Collections类 11-7 泛型概述 11-8 练习题 12-1 多线程 12-2 线程的生命周期 12-3 线程的调度和优先级 12-4 线程的同步 12-5 集合类的同步问题 12-6 用Timer类调度任务 12-7 练习题 13-1 Java IO 13-2 Java IO原理 13-3 流类的结构 13-4 文件流 13-5 缓冲流 13-6 转换流 13-7 数据流 13-8 打印流 13-9 对象流 13-10 随机存取文件流 13-11 zip文件流 13-12 练习题 14-1 图形用户界面设计 14-2 事件处理机制 14-3 AWT常用组件 14-4 swing简介 14-5 可视化开发swing组件 14-6 声音的播放和处理 14-7 2D图形的绘制 14-8 练习题 15-1 反射 15-2 使用Java反射机制 15-3 反射与动态代理 15-4 练习题 16-1 Java标注 16-2 JDK内置的基本标注类型 16-3 自定义标注类型 16-4 对标注进行标注 16-5 利用反射获取标注信息 16-6 练习题 17-1 顶目实战1-单机版五子棋游戏 17-2 总体设计 17-3 代码实现 17-4 程序的运行与发布 17-5 手动生成可执行JAR文件 17-6 练习题 18-1 Java数据库编程 18-2 JDBC类和接口 18-3 JDBC操作SQL 18-4 JDBC基本示例 18-5 JDBC应用示例 18-6 练习题 19-1 。。。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值