java是非常流行的编程语言,用java做一个网站也是相当的方便,这里就分享怎么用javaz做一个网站,使用springboot。
工具/原料
springboot
方法/步骤
2
第二步:在项目的resources里面添加static和templates目录,如图:
3
第三步:在配置文件application.properties里面配置thymeleaf,代码如下:# templates文件夹的路径 spring.thymeleaf.prefix=classpath:/templates/ # templates中的所有文件后缀名 spring.thymeleaf.suffix=.html
4
第四步:在templates的目录里面新建一个index.html文件,如图:
5
第五步:新建一个控制器,代码如下:@RequestMapping('/index') public String index(){ return 'index'; }
6
第六步:启动项目并访问htttp://localhost:8080/index,会出现index.html的内容,如图:
7
第七步:这里是简单的一个页面,一个网站就是由很多单个页面组成的,所以这也是一个简单网站
注意事项
纯手打,请给个赞吧
上一篇:怎么将图片上的文字转换成word
下一篇:酸汤饺子的做法步骤