SpringMVC RESTFul实战案例访问首页

网友投稿 289 2022-07-27


目录SpringMVC RESTFul访问首页实现一、新建 index.http://html二、配置视图控制器三、Idea 部署配置

SpringMVC RESTFul访问首页实现

一、新建 index.html

在 webapp\WEB-INF\templates 下新建首页 index.html。

查看员工信息</a>

二、配置视图控制器

在 springMVC.xml 配置文件里,配置首页的 view-controller。另外还要开启注解驱动。

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context"

xmlns:mvc="http://springframework.org/schema/mvc"

xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context.xsd

http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc.xsd">

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context"

xmlns:mvc="http://springframework.org/schema/mvc"

xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context.xsd

http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc.xsd">

三、Idea 部署配置

点击 配置。

继续按照顺序点击配置。

选择要部署的 war 包,点击确定。

最后为了方便访问,修改下上下文(不改也可以)。

点击部署,成功后自动打开首页。

感谢《尚硅谷》的学习资源。

以上就是SpringMVC RESTFul实战案例访问首页的详细内容,更多关于SpringMVC RESTFul访问首页的资料请关注我们其它相关文章!


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:SpringMVC RESTFul实体类创建及环境搭建
下一篇:SpringMVC RESTFul实现列表功能
相关文章

 发表评论

暂时没有评论,来抢沙发吧~