随笔分类 - Java.SpringBoot.Thymeleaf
摘要:有一个使用Themeleaf模板引擎的Springboot程序,装配完毕后总是跑不起来,控制台里总是报: 2022-03-24 10:29:47.196 - Started MyApplication in 3.783 seconds (JVM running for 5.625) 2022-03-
阅读全文
摘要:用sts编辑themeleaf程序时,由于自动编译的存在,增加html后启动就能访问到; 而Idea需要clean一次,手动促进一次编译,程序才能访问到新增的html文件。 END
阅读全文
摘要:Controlller中: List<String> vnames=。。。。。。 ... session.setAttribute("vnames",vnames); 页面上: <ul th:each="v:{session.vnames}"> <li th:text="{v}"></li> <
阅读全文
摘要:url: http://****/gotoEditGroup?id=28 页面取值:<span th:text="${param.id}"></span>
阅读全文
摘要:放入session: String name="abc123"; session.setAttribute("added", name); 显示: <div th:text="${session.added}"></div> 注意函数要引入session,如: public ModelAndView
阅读全文
摘要:<form action= "...." method="post" enctype="multipart/form-data" > ... </form> 注意上面红字部分,别写错就对了。 END
阅读全文
摘要:设置序号: th:text="{status.index+1}" 设置td的间隔色: th:style="'background-color:'+({status.odd}?'#fff':'#f5f2eb')" 代码: <tbody> <tr th:each="reputaton,status:
阅读全文
摘要:<tbody> <tr th:each="reputaton,status:{rptns}"> <td th:text="{status.index+1}"></td> <td th:text="{reputaton.id}"></td> <td th:text="{reputaton.de
阅读全文
摘要:后端代码: List<String> ls=starService.getAllFamousNames(); mav.addObject("famousNames", ls); 前端代码: <ol> <li th:each="name:${famousNames}"> <span th:text="
阅读全文
摘要:Jsp里有方便的including,Thymeleaf里怎么用呢?可以用th:replace,下面直接就案例来说明。 比如有这么一个左侧导航栏: <div class="sidebar-nav"> <a href="#dashboard-menu" class="nav-header" data-t
阅读全文
摘要:控制器中设值部分: @PostMapping(value="/userLogin") public ModelAndView login(String uname,String pswd,HttpSession httpSession) { User user=userService.searchU
阅读全文
摘要:设值部分: @Controller public class UserCtrl { ... @Autowired private UserService userService; @PostMapping(value="/userRegister") public ModelAndView regi
阅读全文
摘要:要将页面信息传递到控制器中,页面组件和控制器的注解、函数参数一定不能写错了,下面是个简单示例,有兴趣的可以参照: html页面: <div class="block-body"> <form action="userRegister" method="post"> <label>用户名</label
阅读全文
摘要:本文例程: https://files.cnblogs.com/files/heyang78/mediaCool_211010pm.rar src/main/resources/templates 这个目录如果不存在就手动创建,它用于放置你要显示的网页 src/main/resources/stat
阅读全文
摘要:今天翻以前的笔记发现了其中的Dojo代码,它被后来的JQuery取代了,jQuery又被Vue/React要赶下台了,前台真是你未唱罢我登场,程序员每次不跟还不行,跟了把总是觉得新瓶装旧酒,腻歪了。 本文例程下载: https://files.cnblogs.com/files/heyang78/m
阅读全文
摘要:本例工程下载:https://files.cnblogs.com/files/heyang78/myBank_themeleaf_jquery3.6.rar 第一步:在resources目录下新建static目录,再在static目录里新建js目录,然后把jquery-3.6.0.min.js放进去
阅读全文
摘要:本文例程下载:https://files.cnblogs.com/files/heyang78/myBank_themeleaf_post_addstu_210906.rar 第一步:准备含有form的页面。 ...... <table border="0px" width="160px"> <tb
阅读全文
摘要:本文例程下载:https://files.cnblogs.com/files/heyang78/myBank_showdataonpage_210906.rar 只要网页出现了,让其中显示数据就不难,因为控制器里可以注入Mapper,而Mapper是访问DB的,取出数据后放到Model里就好。随后页
阅读全文
摘要:本文例程下载:https://files.cnblogs.com/files/heyang78/myBank_thymeleaf_210906.rar 本文将带您重返石器时代,品尝下本质依旧是jsp/servlet的所谓SpringBoot/thymeleaf新酒。 正文开始: 第一步:在pom.x
阅读全文
摘要:Problem:Jsp中有including,Thymeleaf中有无类似的语法? Solution:有,Themeleaf中提供同样功能的标签是 th:fragment="blockName" 和 th:replace="fileName::blockName" Steps: 1.在共通网页com
阅读全文