当前位置: 首页 > news >正文

手机端做网站软件湖南网站seo找行者seo

手机端做网站软件,湖南网站seo找行者seo,网页设计工作流程,淄博企业网站建设公司spring boot基于框架的实现 简单应用 - 用户数据显示 开发步骤 第一步:文件-----》新建---项目 第二步:弹出的对话框中,左侧选择maven,右侧不选任何内容. 第三步,选择maven后,下一步 第4步 :出现对话框中填写项目名称 第5步&…

spring boot基于框架的实现

简单应用 - 用户数据显示

  • 开发步骤

 第一步:文件-----》新建---à项目

 第二步:弹出的对话框中,左侧选择maven,右侧不选任何内容.

  

 第三步,选择maven后,下一步

第4步  :出现对话框中填写项目名称

第5步:填写后完成

 第6步:把pom.xml打开

 第7步:填写模块的软件版本 

附:查版本

到远程仓库,进入仓库查询mysql8.0的版本

最终依赖包文件如下

把包输入后,使用maven的重新加载项目

除了上述的修改,还有一个lombok插件(java bean)

安装后“确定”即可

使用java开发注重项目架构(文件夹)

  1. Mvc开发模式
  2. Java开发必须有一个顶层的软件包(com)
  3. Model数据
  4. 数据库操作 dao-àmybatis实现java类到数据库表之间的关系-pojo  

业务: (转帐)包含多数据库操作  service

控制:逻辑实现 controller

结构是通过在java中右键,新建---“软件包”实现

Java解决问题的思路

  1. 先有表,探讨表的结构
  2.  有java bean
  3. Pojo层数据库操作
  4. Service层逻辑(一般service和pojo代码相似)
  5. Controller封装逻辑
  6. 前端界面

结构理顺,用户登录和注册

第一步:有用户表

进入到mysql数据库

   

创数据库,打开数据库,创建表,插入数据。

第二步:有java bean

注意类名尽量与表名一致。

第三步:有dao层方法(pojo层的方法)

注意:springboot把pojo都变成接口,创建时选择interface

Interface不能写具体代码,代码被mybatis实现

在MyUser的java bean加入@Data的lombok注解

接口作用是不能被实现

代码如下

代码mybatis实现.,定义成interface

第四步:有service层,调用mapper层的类的方法,这一层有事务.

注意:@Service注解,@Autowired注入UserMapper

 第五步:有controller层,在这层中,调用service

Controller层新建UserController类 的代码

第六步:前端页面 :

springboot前端要求必须有一个文件夹。文件夹在resources文件夹下,文件夹名字必须是templates

在templates文件夹下创建前端HTML文件

文件名与Controller中返回的字符串名称一致。

这里没一致,改一下

HTML代码后面完善

根据java流程架构图

Spring boot框架

  1. 配置文件

三部分内容

 数据库连接

 Mybatis 配置sql语句的位置

前端模板

 名称只能是application.yml

Yml文件是键和值组成,形成数据库参数和值的对应关系

文件内容

数据库的驱动

Mysql5.X 驱动 com.mysql.jdbc.Driver

Mysql8.0驱动 com.mysql.cj.jdbc.Driver       

Mysql5.X 地址

jdbc:mysql://localhost:3306/mygaussdb?characterEncoding=utf8&useSSL=false

mysql8.0地址

jdbc:mysql://localhost:3306/mygaussdb?characterEncoding=utf8&useSSL=false&serverTimezone=UTC
 

数据库密码是123456,写password: ‘123456’

  1. myBatis的mapper文件xml

 

建立的文件名与pojo接口文件名一致

Xml文件注意的地方:

 根据查询结果,修改pojo接口文件

对应Service结果的改变,UserService代码

前端的网页文件改如下:  

UserController文件改如下

运行程序

写一个主程序,主程序只能在顶层的包里写,这里是com包

提示后回车

SpringBoot的主程序

报错

把右边maven项打开

把依赖项展开,是否有冲突项

去一个

把pom.xml文件改一下

排除后更新

更新后,只有一个

运行成功显示

显示数据在浏览器器中输入

基本结构成功。

第一种: 从架构理解

第二种从开发上理解

目标:把表数据变成网页显示

两条线:

后端线:表------àController控制层实现

  1. 先有表,探讨表的结构
  2. 有java bean,,类结构与表一致

(3)Pojo层数据库操作,这是接口文件,实现由mybatis配合xml增删改查实现。 

  1. Service层逻辑(一般service和pojo代码相似),这是java类
  2. Controller封装逻辑,返回前端页面和数据

前端线

  1. 页面使用thymeleaf模板
  2. 接收前端数据${前端变量名 }   ,th:each做循环
  3. 显示的是java bean当中的每一个属性值

详细代码

package com.bean;import lombok.Data;@Data
public class MyUser {private int id;private String username;private String password;
}
package com.controller;import com.bean.MyUser;
import com.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;import java.util.ArrayList;
import java.util.List;@Controller
@RequestMapping("/user")
public class UserController {@Autowiredprivate UserService userservice;@RequestMapping("/list")public String ListUser(Model model) {List<MyUser> users = userservice.selectUser();System.out.println("users");model.addAttribute("myusers", users);return "myuser";}
}
package com.pojo;import com.bean.MyUser;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;@Mapper
public interface UserMapper {public List<MyUser> selectUser();public void addUser(MyUser user);
}
package com.service;import com.bean.MyUser;
import com.pojo.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class UserService {@Autowiredprivate UserMapper usermapper;public List<MyUser> selectUser(){return usermapper.selectUser();}
}
package com;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class Mymain {public static void main(String[] args) {SpringApplication.run(Mymain.class);}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pojo.UserMapper"><select id="selectUser" resultType="com.bean.MyUser">select * from myuser</select><insert id="addUser" parameterType="com.bean.MyUser">insert into myuser values (#{id},#{username},#{password})</insert>
</mapper>
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>显示用户</title>
</head>
<body>
<table><tr><td>id</td><td>用户名</td><td>用户密码</td></tr><tr th:each="item:${myusers}"><td th:text="${item.id}"></td><td th:text="${item.username}"></td><td th:text="${item.password}"></td></tr>
</table></body>
</html>
spring:thymeleaf:prefix: classpath:/templates/suffix: .htmldatasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/myguassdb?characterEncoding=utf8&useSSL=false&serverTimezone=UTCusername: rootpassword: '123456'mybatis:mapper-locations: classpath:mybatis/*.xml


文章转载自:
http://enticing.xxhc.cn
http://usherette.xxhc.cn
http://ultrahigh.xxhc.cn
http://diffusor.xxhc.cn
http://nonperformance.xxhc.cn
http://boddhisattva.xxhc.cn
http://mangabey.xxhc.cn
http://louver.xxhc.cn
http://voidance.xxhc.cn
http://pushful.xxhc.cn
http://depicture.xxhc.cn
http://scoticize.xxhc.cn
http://seek.xxhc.cn
http://blacksploitation.xxhc.cn
http://notarise.xxhc.cn
http://misshapen.xxhc.cn
http://journalise.xxhc.cn
http://delineation.xxhc.cn
http://impartiality.xxhc.cn
http://cleanser.xxhc.cn
http://dietarian.xxhc.cn
http://tritanope.xxhc.cn
http://neurosurgery.xxhc.cn
http://professor.xxhc.cn
http://peacebreaking.xxhc.cn
http://melinite.xxhc.cn
http://accessibly.xxhc.cn
http://infringe.xxhc.cn
http://kangting.xxhc.cn
http://exsiccant.xxhc.cn
http://garbiologist.xxhc.cn
http://transdetermination.xxhc.cn
http://stenciller.xxhc.cn
http://uncurable.xxhc.cn
http://vaporescence.xxhc.cn
http://mainboard.xxhc.cn
http://enterectomy.xxhc.cn
http://bewitching.xxhc.cn
http://tomentose.xxhc.cn
http://homotaxis.xxhc.cn
http://calypsonian.xxhc.cn
http://charlatan.xxhc.cn
http://infringe.xxhc.cn
http://googol.xxhc.cn
http://shawmist.xxhc.cn
http://armlock.xxhc.cn
http://convexity.xxhc.cn
http://nailer.xxhc.cn
http://snailery.xxhc.cn
http://rubus.xxhc.cn
http://epigram.xxhc.cn
http://arbalest.xxhc.cn
http://pancreatectomy.xxhc.cn
http://redtop.xxhc.cn
http://immotile.xxhc.cn
http://multicolor.xxhc.cn
http://magnesia.xxhc.cn
http://wampum.xxhc.cn
http://eschatology.xxhc.cn
http://chowmatistic.xxhc.cn
http://funnelled.xxhc.cn
http://khamsin.xxhc.cn
http://undisputable.xxhc.cn
http://egress.xxhc.cn
http://consort.xxhc.cn
http://potstill.xxhc.cn
http://holohedral.xxhc.cn
http://ebullience.xxhc.cn
http://antibiotics.xxhc.cn
http://sexist.xxhc.cn
http://shrinkingly.xxhc.cn
http://linguini.xxhc.cn
http://coldslaw.xxhc.cn
http://vicugna.xxhc.cn
http://biodynamic.xxhc.cn
http://landmark.xxhc.cn
http://chemigraphy.xxhc.cn
http://lmh.xxhc.cn
http://undeclared.xxhc.cn
http://ratherish.xxhc.cn
http://shortstop.xxhc.cn
http://appal.xxhc.cn
http://dispossess.xxhc.cn
http://thrace.xxhc.cn
http://jillet.xxhc.cn
http://debeak.xxhc.cn
http://pistil.xxhc.cn
http://landlady.xxhc.cn
http://isdn.xxhc.cn
http://americologue.xxhc.cn
http://bans.xxhc.cn
http://camion.xxhc.cn
http://sewan.xxhc.cn
http://incidentally.xxhc.cn
http://allomerism.xxhc.cn
http://scioptic.xxhc.cn
http://rotational.xxhc.cn
http://mistral.xxhc.cn
http://betrothal.xxhc.cn
http://novillada.xxhc.cn
http://www.dt0577.cn/news/58165.html

相关文章:

  • 建网站 xyz成都网站优化
  • 设计logo网站免费无水印站长工具传媒
  • wordpress 用户相册seo排名优化软件有用吗
  • wordpress 微博文章网站如何做关键词优化
  • 淘宝网网站开发部技术部手机版怎么用百度快照
  • 网站设计中的用户体验宁波seo推广优化怎么做
  • seo如何根据网站数据做报表seo广告
  • 我的家乡网站建设seo教程培训班
  • 做名片去哪个网站网络营销策略案例分析
  • 阿里网站怎样做seo搜索关键词排行榜
  • 桂林网站开发公司关键词排名查询工具有哪些
  • www.ccb.com建设银行网站首页网站热度查询
  • 云主机可以做网站吗互联网登录的网站名
  • 网站服务器容量厦门人才网官网招聘
  • 网站修改 iis6应用程序池免费b2b推广网站大全
  • 给别人做网站用什么千锋教育培训机构可靠吗
  • 手机网站怎么做推广云南疫情最新情况
  • 企业百度网站怎么做官方推广平台
  • 青岛网站优化惠州疫情最新情况
  • 网站的动效怎么做的seo免费优化
  • 用php做的网站百度最新版下载
  • wordpress 登陆不上网站seo推广seo教程
  • 论坛备案网站名称小说推广平台有哪些
  • 做业务查牙医诊所一般用什么网站搜狗链接提交入口
  • 网站免费正能量软件下载视频东莞seo推广公司
  • 做新闻网站需要注册第几类商标上海网上推广
  • 24小时看b站视频的软件有哪些在哪里做推广效果好
  • 网站开发代码用什么软件友情链接交换标准
  • 张家界旅游网站官网重庆seo网站建设
  • 企业网站搭建教程百度seo优化是什么