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

php做各种网站类型得模板停放域名

php做各种网站类型得模板,停放域名,网络科技公司起名字大全免费,深圳装修公司哪家好目录 引言 使用 1、新建模块 2、导入坐标 3、创建SpringMVC控制器类 4、初始化SpringMVC环境 5、初始化Servlet容器#xff0c;加载SpringMVC环境 6、配置运行 引言 SpringMVC是一种基于Java实现MVC模型的轻量级Web框架#xff0c;SpringMVC是表现层(web层)的框架,也…目录 引言 使用 1、新建模块 2、导入坐标 3、创建SpringMVC控制器类 4、初始化SpringMVC环境 5、初始化Servlet容器加载SpringMVC环境 6、配置运行 引言 SpringMVC是一种基于Java实现MVC模型的轻量级Web框架SpringMVC是表现层(web层)的框架,也是spring框架的一部分用于表现层功能开发。 使用SpringMVC 1、新建模块 如下 注意有些人可能出现无src文件的情况这是因为下载太慢 如何解决上述问题引入国内镜像 setting.xml文件替换为以下内容 ?xml version1.0 encodingUTF-8? settings xmlnshttp://maven.apache.org/SETTINGS/1.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsdmirrorsmirroridalimaven/idnamealiyun maven/nameurlhttp://maven.aliyun.com/nexus/content/groups/public//urlmirrorOfcentral/mirrorOf/mirrormirroriduk/idmirrorOfcentral/mirrorOfnameHuman Readable Name for this Mirror./nameurlhttp://uk.maven.org/maven2//url/mirrormirroridCN/idnameOSChina Central/nameurlhttp://maven.oschina.net/content/groups/public//urlmirrorOfcentral/mirrorOf/mirrormirroridnexus/idnameinternal nexus repository/nameurlhttp://repo.maven.apache.org/maven2/urlmirrorOfcentral/mirrorOf/mirror!-- junit镜像地址 --mirroridjunit/idnamejunit Address//nameurlhttp://jcenter.bintray.com//urlmirrorOfcentral/mirrorOf/mirrormirror!--This sends everything else to /public --idnexus-aliyun/idmirrorOf*/mirrorOfnameNexus aliyun/nameurlhttp://maven.aliyun.com/nexus/content/groups/public/url/mirrormirroridosc/idmirrorOf*/mirrorOfurlhttp://maven.oschina.net/content/groups/public//url/mirrormirroridrepo2/idmirrorOfcentral/mirrorOfnameHuman Readable Name for this Mirror./nameurlhttp://repo2.maven.org/maven2//url/mirrormirroridnet-cn/idmirrorOfcentral/mirrorOfnameHuman Readable Name for this Mirror./nameurlhttp://maven.net.cn/content/groups/public//url/mirrormirroridui/idmirrorOfcentral/mirrorOfnameHuman Readable Name for this Mirror./nameurlhttp://uk.maven.org/maven2//url/mirrormirroridibiblio/idmirrorOfcentral/mirrorOfnameHuman Readable Name for this Mirror./nameurlhttp://mirrors.ibiblio.org/pub/mirrors/maven2//url/mirrormirroridjboss-public-repository-group/idmirrorOfcentral/mirrorOfnameJBoss Public Repository Group/nameurlhttp://repository.jboss.org/nexus/content/groups/public/url/mirrormirroridJBossJBPM/idmirrorOfcentral/mirrorOfnameJBossJBPM Repository/nameurlhttps://repository.jboss.org/nexus/content/repositories/releases//url/mirror/mirrors /settings 2、导入坐标 在pom.xml文件中导入springmvc和servlet。 注意刷新maven dependenciesdependencygroupIdjavax.servlet/groupIdartifactIdjavax.servlet-api/artifactIdversion3.1.0/versionscopeprovided/scope/dependencydependencygroupIdorg.springframework/groupIdartifactIdspring-webmvc/artifactIdversion5.2.10.RELEASE/version/dependency/dependencies 3、创建SpringMVC控制器类 用于处理请求。 Controller设定SpringMVC的核心控制器bean定义为bean RequestMapping设置当前控制器方法请求访问路径 ResponseBody设置当前控制器方法响应内容为当前返回值返回给前端 Controller public class UserController {RequestMapping(/save)ResponseBodypublic String save(){System.out.println(user save ...);return {module:springmvc};} } 4、初始化SpringMVC环境 加载对应的bean Configuration ComponentScan(com.spring.controller) public class SpringMvcConfig { } 5、初始化Servlet容器加载SpringMVC环境 public class ServletContainersInitConfig extends AbstractDispatcherServletInitializer {//加载springMVC容器配置protected WebApplicationContext createServletApplicationContext() {AnnotationConfigWebApplicationContext ctx new AnnotationConfigWebApplicationContext();ctx.register(SpringMvcConfig.class);return ctx;}//设置哪写请求归属springMVC处理protected String[] getServletMappings() {return new String[]{/};}//加载spring容器配置protected WebApplicationContext createRootApplicationContext() {return null;} 6、配置运行 pom.xml文件需要有以下内容 配置tomcatjdk版本为1.8 propertiesproject.build.sourceEncodingUTF-8/project.build.sourceEncodingmaven.compiler.source1.8/maven.compiler.sourcemaven.compiler.target1.8/maven.compiler.target/propertiesdependenciesdependencygroupIdjavax.servlet/groupIdartifactIdjavax.servlet-api/artifactIdversion3.1.0/versionscopeprovided/scope/dependencydependencygroupIdorg.springframework/groupIdartifactIdspring-webmvc/artifactIdversion5.2.10.RELEASE/version/dependency/dependenciesbuildpluginsplugingroupIdorg.apache.tomcat.maven/groupIdartifactIdtomcat7-maven-plugin/artifactIdversion2.1/versionconfigurationport80/portpath//path/configuration/plugin/plugins/build 运行程序浏览器输入http://localhost/save打印出save()方法return内容即成功后端控制台打印出save()方法输出内容。
http://www.zqtcl.cn/news/8052/

相关文章:

  • 域名和网站名要一样吗湖南建设人才网
  • 档案网站建设经验2015做哪些网站能致富
  • 做网站怎样办营业执照四平网站设计公司
  • 上海长宁区网站建设fizz wordpress
  • 浏阳网站开发建设海外医疗手机网站建设
  • 企业网站开发需求文档福建省机关效能建设网站
  • 爱站权重查询金融网站模版下载
  • 肥城网站设计公司百度对网站建设公司
  • 做企业网站如何用代码做网站
  • 网站运营方案设计网页设计报告模板免费
  • 成都网站建设方案阿里云代理网站怎么做
  • app开发模板网站企业地址管理系统
  • 深圳龙华区住房和建设局网站网站维护服务内容
  • 谷谷互联建的网站如何把qq在线做外贸网站做成哪种形式好
  • 爱用建站怎么样校园网站建设系统设计
  • 网站备案证书打印电商网站开发技术与服务器
  • 公司网站开发费用济南兴田德润o简介图片网站的服务器怎么做
  • 网站建设九步走张家港网站网络优化
  • 泸州市规划建设局网站做网站点击量有用吗
  • 个人可以做聊天网站备案吗开发员给我用织梦做的网站
  • 推广网站怎么制作成功的软文推广
  • 网站建设 参照 标准规范wordpress编辑菜单
  • 北京做微信网站wordpress好看主题
  • 小说网站排名人气建设网银官网
  • 网站上线 流程珠海网站推广优化
  • 门户网站产品设计方案知名网站开发哪家好
  • 揭阳网站免费建站互站网源码
  • 泉州建设工程质量网站美食网站网站建设定位
  • 太原网站建设全包顺德做网站shundeit
  • 网站建设业务活动运转灵活小企业网站建设