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

网站如何做成app生成链接

网站如何做成app,生成链接,网站建设是不是都需要交费,网站备案正常多久这里我就简单的聊几句#xff0c;如何用vertx web来搞一个web项目的 1、首先先引入几个依赖#xff0c;这里我就用maven了#xff0c;这个是kotlinvertx web ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apac…这里我就简单的聊几句如何用vertx web来搞一个web项目的 1、首先先引入几个依赖这里我就用maven了这个是kotlinvertx web ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdorg.example/groupIdartifactIdkotlin-vertx/artifactIdversion1.0-SNAPSHOT/versionpropertiesmaven.compiler.source17/maven.compiler.sourcemaven.compiler.target17/maven.compiler.targetproject.build.sourceEncodingUTF-8/project.build.sourceEncodingkotlin.version1.8.20/kotlin.version/propertiesdependenciesdependencygroupIdio.vertx/groupIdartifactIdvertx-core/artifactId/dependencydependencygroupIdio.vertx/groupIdartifactIdvertx-codegen/artifactId/dependencydependencygroupIdio.vertx/groupIdartifactIdvertx-service-proxy/artifactId/dependencydependencygroupIdio.vertx/groupIdartifactIdvertx-web/artifactId/dependencydependencygroupIdio.vertx/groupIdartifactIdvertx-auth-common/artifactId/dependencydependencygroupIdch.qos.logback/groupIdartifactIdlogback-classic/artifactIdversion1.2.3/version/dependencydependencygroupIdorg.jetbrains.kotlinx/groupIdartifactIdkotlinx-coroutines-core/artifactIdversion1.7.1/version/dependencydependencygroupIdorg.jetbrains.kotlin/groupIdartifactIdkotlin-stdlib-jdk8/artifactIdversion${kotlin.version}/version/dependencydependencygroupIdorg.jetbrains.kotlin/groupIdartifactIdkotlin-test/artifactIdversion${kotlin.version}/versionscopetest/scope/dependency/dependenciesbuildpluginsplugingroupIdorg.jetbrains.kotlin/groupIdartifactIdkotlin-maven-plugin/artifactIdversion${kotlin.version}/versionexecutionsexecutionidcompile/idphasecompile/phasegoalsgoalcompile/goal/goalsconfigurationsourceDirssourcesrc/main/java/sourcesourcetarget/generated-sources/annotations/source/sourceDirs/configuration/executionexecutionidtest-compile/idphasetest-compile/phasegoalsgoaltest-compile/goal/goals/execution/executionsconfigurationjvmTarget${maven.compiler.target}/jvmTarget/configuration/pluginplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdexecutionsexecutioniddefault-compile/idphasenone/phase/executionexecutioniddefault-testCompile/idphasenone/phase/executionexecutionidcompile/idphasecompile/phasegoalsgoalcompile/goal/goals/executionexecutionidtestCompile/idphasetest-compile/phasegoalsgoaltestCompile/goal/goals/execution/executions/plugin/plugins/builddependencyManagementdependenciesdependencygroupIdio.vertx/groupIdartifactIdvertx-dependencies/artifactIdversion4.4.4/versiontypepom/typescopeimport/scope/dependency/dependencies/dependencyManagement/project 2、先创建一个简单的httpweb package org.example.kotlin_webimport io.vertx.core.AbstractVerticle import io.vertx.core.Vertx import io.vertx.core.http.HttpServerOptions import io.vertx.ext.web.Router import kotlinx.coroutines.delayclass HttpWeb : AbstractVerticle() {override fun start() {var router Router.router(vertx);router.get(/hello).handler { context -context.response().end(Hello World)};vertx.createHttpServer().requestHandler(router).listen(8080)} } fun main(){var vertx Vertx.vertx();vertx.deployVerticle(HttpWeb()) } 这里用了路由也就是说访问localhost:8080/hello  它会输出Hello World这个是get请求 3、get请求带参数 package org.example.kotlin_webimport io.vertx.core.AbstractVerticle import io.vertx.core.Vertx import io.vertx.ext.web.Routerclass HttpWeb : AbstractVerticle() {override fun start() {var router Router.router(vertx);router.get(/hello).handler { ctx -val name: String ctx.request().getParam(name)// 处理逻辑val message Hello, $name!// 返回响应ctx.response().end(message)};vertx.createHttpServer().requestHandler(router).listen(8080)} } fun main(){var vertx Vertx.vertx();vertx.deployVerticle(HttpWeb()) } 可以看到非常简单 4、post请求带参数 package org.example.kotlin_webimport io.vertx.core.AbstractVerticle import io.vertx.core.Vertx import io.vertx.core.buffer.Buffer import io.vertx.ext.web.Router import io.vertx.ext.web.RoutingContext import io.vertx.ext.web.handler.StaticHandlerclass HttpWeb : AbstractVerticle() {override fun start() {var router Router.router(vertx);router.route().handler(StaticHandler.create(src/main/resources/static).setCachingEnabled(false).setDefaultContentEncoding(UTF-8));router.get(/hello).handler { ctx -val name: String ctx.request().getParam(name)// 处理逻辑val message Hello, $name!// 返回响应ctx.response().end(message)};router.post().path(/index).handler { ctx: RoutingContext -val request ctx.request()val response ctx.response()response.putHeader(Content-Type, text/plain; charsetutf-8)val formAttributes request.formAttributes()request.bodyHandler { body: Buffer -val formData body.toString()println(Received form data: $formData)response.setStatusCode(200)response.end(Form submitted successfully)}}vertx.createHttpServer().requestHandler(router).listen(8080)} } fun main(){var vertx Vertx.vertx();vertx.deployVerticle(HttpWeb()) } index.html !DOCTYPE html html langen headmeta charsetUTF-8titleindex/title /head body form methodpost actionhttp://localhost:8080/index姓名: input typetext namename br密码: input typepassword namepassword brinput typesubmit /form /body /html 这里的所有代码都写到了同一个文件里面这样极其的不美观可以优化一下
http://www.tj-hxxt.cn/news/143693.html

相关文章:

  • 网站 美化网站后台怎么不能上传图片
  • 济南建设网站需要网站建设的步骤目标规划
  • 黄骅市海边seo技术培训班
  • 珠海专业网站建设价格房山网站制作
  • 报价网站系统网站所有权问题
  • 怎么做网站教程视频微信怎么建设网站
  • 扬州公司做网站公司网站怎么加关键词做优化
  • 一个完整的网站 技术百度免费下载安装
  • 做网站如何选择颜色上海微信网站制作哪家专业
  • 掌握cms建设网站实训报告做的漂亮的家居网站
  • dw学校网站制作教程网站开发维护成本
  • 关于网站建设领导分工做百度手机网站优化
  • 企业做可信网站认证的好处手机制作3d动画
  • 网站做系统叫什么软件企业网站轮播图怎么做
  • 张家界做网站找谁付费下载网站源码
  • 吴忠市住房和城乡建设局网站苏州新闻今天最新消息新闻事件
  • seo网站合作大学生做网站
  • 新洲网站建设做网站需要什么配置服务器吗
  • 做网站总结体会淘宝 客要推广网站怎么做
  • 双语网站系统绍兴网络科技有限公司
  • 网站开发技术html5视频网站切片怎么做
  • 汉口网站建设制作网站建设 资产
  • 有什么网站可以免费建站中国好公司网站建设
  • 网站建设咨询推荐装潢设计专业就业前景
  • 免费做店招的网站网站设计导航
  • 二级域名如何绑定网站网站建设询价单
  • phpcms仿站东莞南城电子网站建设
  • 桐乡网站开发网站没后台怎么修改类容
  • 建视频网站需要多少钱网站建设工作策划方案
  • 建设解锁卡网站首页郑州微盟网站建设公司