doulianqi3870 2013-08-15 19:12
浏览 150
已采纳

如何在HTML中嵌入Scala?

Coming from a background in PHP, I am used to the idea that I can simply embed server-side scripts into my HTML pages. Searching online, I haven't been able to find a simple echo <h1>Hello World</h1>; equivalent in Scala besides using a web framework like Lift. Can I do this with Scala?

  • 写回答

2条回答 默认 最新

  • drjun1994 2013-08-15 19:21
    关注

    PHP is an exception in being a language designed to be embedded in an HTML page. Apache has mod_php to do this for you. Scala, like many other languages, requires you to start up a web server to respond to requests and render HTML. You can use frameworks like Lift or Play, or you can make a Servlet-based app and deploy it into any Servlet container.

    You could set up an Apache server to run CGI scripts and then insert a .scala file to be run by the scala command - but it would be incredibly slow as it would have to start up the Java VM every time. I wouldn't recommend that for anything other than scratching a mental itch.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码