Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I didn't understood the term javascript Engine, What does it mean.

 
Rahul Shivsharan
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I searched on Wikipedia , but i didn't understood the explanation.

Many article says that Javascript engine is used for "Javascript Web server",

But how come web server ?

I have worked on Tomcat server and having knowledge of J2EE framwork,
here a browser send request using a url, now this request hits the web container(Tomcat),
now web container creates req. and res. object and passes it to servlets deployed in webcontainer.



Now from my above knowledge of Web container can you please explain how come javascript be
a web container, and how does it helps us in client-side javascript


Does javascript engine has anything to do with auto-refresh of web-pages

Waiting for the reply
 
Karthik Shiraly
Bartender
Posts: 1203
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Javascript is a programming language, like any other language. Like any language, it is capable of doing anything that its compiler/interpreter/runtime allows.
Historically, it's associated with client side web browser interaction, but that is only because the first javascript engines were browser centric.
New engines like Node.js give it capabilities like threads and sockets, which means it can run like any server side language.

In fact, it's possible to serve HTTP requests using Javascript even from a regular JavaEE environment, using JavaSE6 scripting API and with a little help from regular servlets. Trythis servlet which gets all HTTP HTML responses from javascript code by loading and executing an appropriate JS file based on path in HTTP request:



//sayHello.js - invoke with http://localhost:8080/JavaScriptServlet/sayHello


//table.js - invoke with http://localhost:8080/JavaScriptServlet/table?header=Title


In this example, javascript code is piggybacking on JRE for sockets and other system resources. In pure javascript servers like Node.js, the Node runtime provides sockets and other system resources.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic