一、在resource目录下面建立文件夹,里面方静态页面。

路径:src\main\resources\static\page\index.html

访问:http://localhost:8080/page/index.html

注意:后缀一定要html或者htm,否则打不开。

二、Spring Controller返回页面

访问:http://localhost:8080/index

注意:前端不能获取后台传递值,因为html不支持EL表达式。jsp或者模板引擎才支持

@Controller
public class HelloController { @RequestMapping("/index")
public String index(){
System.out.println("coming......");
return "page/index.html";
} @RequestMapping("/index2")
public ModelAndView index2(ModelAndView modelAndView){
System.out.println("coming......");
modelAndView.addObject("name","tom");
modelAndView.setViewName("page/index.html");
return modelAndView;
} }

最新文章

  1. linux开启telnet
  2. 在 远程桌面 权限不足无法控制 UAC 提示时,可使用 计划任务 绕开系统的 UAC 提示
  3. session 实现保存用户信息
  4. ApplicationIdle
  5. 重写session
  6. sql join 用法
  7. Nexus 刷机
  8. 2014第6周五JS调试
  9. Weblogic 部署注意事项
  10. HRBUST1522【单调队列+DP】
  11. vue+cordova 构建hybrid app
  12. C++对象模型的那些事儿之二:对象模型(下)
  13. 磁盘挂载问题:Fdisk最大只能创建2T分区的盘,超过2T使用parted
  14. 【凸包板题】Gym - 101484E E. Double Fence
  15. 20170915 shell
  16. ubuntu下没有ping命令
  17. 关于cookie和session
  18. IOS网络篇1之截取本地URL请求(NSURLProtocol)
  19. 洛谷P1083 借教室 NOIP2012D2T2 线段树
  20. JBPM4.4_管理流程定义

热门文章

  1. JPress的CMS系统在Window下的部署和使用
  2. InfluxDB和MySQL的读写对比测试
  3. XPAGES 中CGI变量的获取
  4. 10个超棒jQuery表单操作代码片段
  5. OpenCV学习代码记录——canny边缘检测
  6. 拦截导弹问题(NOIP1999)
  7. 六大主流开源SQL引擎总结
  8. 基于源码编译openssl
  9. 【php+微擎】微擎学习相关帮助推荐
  10. hihocoder第229周:最大连续字母个数