day54(微博练习步骤:注册登陆,上传发表,内容保存到weibo数据库,会话管理,Session对象)
1.微博练习步骤
-
创建boot5-1工程 3个打钩
-
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.url=jdbc:mysql://localhost:3306/weibo?characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
\#设置文件上传大小的限制
spring.servlet.multipart.max-file-size=10MB
-
创建数据库和表
create database weibo charset=utf8;
use weibo;
create table user(id int primary key auto_increment,username varchar(50),password varchar(50),nick varchar(50))charset=utf8;
-
在工程中添加首页index.html 在工程中添加js和css文件夹(从4-2工程中复制),添加完之后 Buil->ReBuild
-
创建微博表
use weibo;
create table weibo(id int primary key auto_increment,content varchar(100),url varchar(255),nick varchar(50),created timestamp,user_id int)charset=utf8;
2.注册登陆项目流程:
1.首页
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>微博首页</h1>
<div>
<div v-if="isLogin">
<p>欢迎{{user.nick}}回来</p>
<a href="insert.html">发布微博</a>
<a href="javascript:void(0)"