在浏览器中运行Kotlin HTML Builder [英] Running Kotlin HTML Builder in the Browser

查看:200
本文介绍了在浏览器中运行Kotlin HTML Builder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Kotlin的Java开发人员.虽然我喜欢这种语言,但是我喜欢用它完成Web应用程序的轻松程度.问题是我无法弄清楚如何在浏览器中运行Kotlin HTML构建器文件,以便可以在kotlin中创建基本的网页框架.我可以在IDE中输出它,但是要使其在我的浏览器中运行似乎很难.这可能是一个愚蠢的问题,我遗漏了一些非常明显的内容,但似乎无法在线找到答案.

I am a Java developer that is very new to Kotlin. I love the language though, and I like how easily web applications can be done with it. The problem is that I cannot figure out how to run Kotlin HTML builder files in the browser, so that I can create a basic web page skeleton in kotlin. I can output it in the IDE, but it is silly how hard it seems to be to get it to run in my browser. This may be a dumb question and I'm missing something very obvious, but I can't seem to find the answer online.

请记住,我没有使用Intelli-J IDE.很乐意,但无力承担仅在Kotlin中进行Web开发而付出的代价.一直在使用Eclipse.

Keep in mind that I'm not using the Intelli-J IDE. Would love to, but can't afford to pay out the nose just to do web development in Kotlin. Been using Eclipse.

谢谢.

推荐答案

使用Kotlin html构建器kotlinx.html或任何其他此类构建器时,您需要按顺序构建为浏览器获取HTML.

When you use Kotlin html builders kotlinx.html or any other of that sort, you need to, well, build them in order to get HTML for the browser.

没有"Kotlin构建器文件"之类的东西.这些构造是普通的Kotlin代码,因此您可以在(服务器?)代码库中编写它们,编译,然后调用以生成HTML响应.这也意味着您需要一个(普通的Java)路由器框架,例如Spark.

There are no such thing as "Kotlin builder files". Those constructs are plain Kotlin code, so you write them inside your (server?) codebase, compile them and then invoke them to generate HTML responses. This also means you need a (normal Java) router framework, like Spark for example.

总而言之,html-builders是一种生成HTML字符串的方法,因此它们不包括将HTML运送到其他地方的方法.

To sum up, html-builders are a way to generate HTML strings, so they do not include a way to ship the HTML elsewhere.

这篇关于在浏览器中运行Kotlin HTML Builder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆