Java教程

JAVA进阶训练营(2021最新版)

本文主要是介绍JAVA进阶训练营(2021最新版),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

download:JAVA进阶训练营(2021最新版)

哪些人适合报名 Java 进阶训练营?

2 年及以上工作经验的 Java 工程师
面临瓶颈,急需突破的 Java 工程师
想升职加薪,进大厂的 Java 工程师
想建立自己的知识体系的 Java 工程师

Q:是否有基础要求?
你需要有 2 年以上的 Java 工作经验,掌握 Java 基础语法,并有相关的项目经验。

Q:课程学完后能到什么水平?
Java 进阶训练营课程设计对标阿里 P7,课程中的项目实战开发,不仅仅让你提升了 Java 编程技能,同时也会培养你进入一线互联网大厂必备的思维能力。
我们的课程培养目标是大厂的高级 Java 工程师、资深 Java 开发工程师、Java 技术专家和 Java 架构师,按照讲师的路径规划,用心努力学习,完成每一个实战项目,就可以具备成为 Java 架构师和进入一线大厂的能力。
public Book() {
}

复制
public Book(String id, String name, String price, String auth,
String publish, String description) {
super();
this.id = id;
this.name = name;
this.price = price;
this.auth = auth;
this.publish = publish;
this.description = description;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
public String getPublish() {
return publish;
}
public void setPublish(String publish) {
this.publish = publish;
}
}

import java.util.LinkedHashMap;
import java.util.Map;
import cn.huiyu.ben.Book;
public class BookDao {
private static Map<String,Book> bookMap = new LinkedHashMap<String, Book>();
private BookDao() {
}
static{
bookMap.put("1", new Book("1","1111","11.0","zqwang","111出版社","111111111"));
bookMap.put("2", new Book("2","2222","22.0","zqwang","222出版社","222222222"));
bookMap.put("3", new Book("3","3333","33.0","zqwang","333出版社","333333333"));
}

复制
public static Map<String,Book> getBooks(){
return bookMap;
}
public static Book getBook(String id){
return bookMap.get(id);
}
}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
//1.查询数据库中一切的书展示
Map<String,Book> map = BookDao.getBooks();
for(Map.Entry<String , Book> entry : map.entrySet()){
Book book = entry.getValue();
response.getWriter().write(""+book.getName()+"
");
}
response.getWriter().write("
");

复制
//2.显现之前看过的书
Cookie [] cs = request.getCookies();
Cookie findC = null;
if(cs!=null){
for(Cookie c : cs){
if("last".equals(c.getName())){
findC = c;
}
}
}
if(findC == null){
response.getWriter().write("没有看过任何书!");
}else{
response.getWriter().write("您曾经阅读过的书:
");
String[] ids = findC.getValue().split(",");
for(String id : ids){
Book book = BookDao.getBook(id);
response.getWriter().write(book.getName()+"
");
}
}
}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
//1.获取要看的书的id,查询数据库找出书,输出书的细致信息
String id = request.getParameter("id");
Book book = BookDao.getBook(id);
if(book==null){
response.getWriter().write("找不到这本书!");
return;
}else{
response.getWriter().write("
书名:"
+book.getName()+"");
response.getWriter().write("
作者:"
+book.getAuth()+"");
response.getWriter().write("
售价:"
+book.getPrice()+"");
response.getWriter().write("
出版社:"
+book.getPublish()+"");
response.getWriter().write("
描画信息:"
+book.getDescription()+"");
}

复制
//2.发送cookie保管最后看过的书
// --- 1 --> 1
// 1 --2,1 --> 2,1
// 2,1--3,2,1 --> 3,2,1
// 3,2,1 -- 4,3,2 --> 4,3,2
// 4,3,2 --3,4,2 --> 3,4,2
String ids = "";
Cookie [] cs = request.getCookies();
Cookie findC = null;
if(cs!=null){
for(Cookie c : cs){
if("last".equals(c.getName())){
findC = c;
}
}
}
if(findC == null){
//说明之前没有看过书的记载
ids += book.getId();
}else{
//说明之前有历史看过的书的记载,需求根据历史记载算一个新的记载出来
String [] olds = findC.getValue().split(",");
StringBuffer buffer = new StringBuffer();
buffer.append(book.getId()+",");
for(int i = 0;i<olds.length && buffer.toString().split(",").length<3 ;i++){
String old = olds[i];
if(!old.equals(book.getId())){
buffer.append(old+",");
}
}
ids = buffer.substring(0, buffer.length()-1);
}
Cookie lastC = new Cookie("last",ids);
lastC.setMaxAge(36002430);
lastC.setPath(request.getContextPath());
response.addCookie(lastC);
}

这篇关于JAVA进阶训练营(2021最新版)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!