[erlang-questions] ANNOUNCE: adapter_pattern for mochiweb/cowboy/misult and scripting language

Edmond Begumisa ebegumisa@REDACTED
Mon Feb 20 19:29:32 CET 2012

On Mon, 20 Feb 2012 12:19:40 +1100, Richard O'Keefe <ok@REDACTED>  

> The "native HTML" way to do it would be to write an HTML page using any  
> HTML editor you like, attach hook points to it using 'class' and 'id',  
> use
> <script> to attach file-specific code, and give it to process that parses
> it, applies the transforms loaded by the <script>, and emits plain HTML.


There was a rather clever mozilla-based web-server called Jaxer that  
provided this kind of "server-side DOM" web-programming style. It was  
essentially Firefox without the rendering code running on Apache.

An html file on the server could have <script> tags with a special "runat"  
attribute. If runat="server", then Jaxer would process the script server  
side (with full access to the DOM and everything you normally get on the  
client side). The webserver would then send the processed file to the  
browser. The idea was that you'd use typically client-side JavaScript to  
write web-server code, but I digress.

Although I can picture an Erlang web-framework working in a simlar fashion  
as you describe (hoping this is in fact similar to what you're  
describing), using Joe's example...

== foo.html ==
   <script type="application/erlang" src="foo.erl" runat="server" />
   So <span id="foo-name" /> has <span id="foo-chars" /> characters

== foo.erl ==
on_load(Html0) ->
   Name = "Joe",
   Html1 = dom:set_node_value(dom:get_element_by_id(Html0, "foo-name"),
   dom:set_node_value(dom:get_element_by_id(Html1, "foo-chars"),

... I'll note that Jaxer never really gained traction and to my  
disappointment it's developer's (Aptana) stopped working on it. Though I  
personally like this style because of it's consistency with client-side  
web-programming, perhaps it's too strange for most web-developers (even  
though it shouldn't be) who seem to prefer the template style.

Nonetheless, I would love to see an Erlang Jaxer.

- Edmond -

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/-

More information about the erlang-questions mailing list