What is server-side Javascript? Can I replace PHP applications with applications written with server-side Javascript? If this is possible, does ExtJS support server-sid开发者_JS百科e Javascript?
what is server-side javascript ?
Program code running on a server that happens to be written in JS.
can it replace php with server-side javascript?
Yes
if it exists do extjs has serverside javascript ?
ExtJS is a UI library, it doesn't do anything that would be all that useful server side.
You might be able to get some use out of it (little bits of it) in a similar fashion to this approach used to use YUI on the server: http://www.yuiblog.com/blog/2010/04/05/running-yui-3-server-side-with-node-js/
ASP Classic and .NET both support JScript as a server-side language. There is also the Helma framework which uses JavaScript for scripting, but itself is Java-based.
As I know, the so called "Server-side Javascript" relies on the server technology.
http://www.devarticles.com/c/a/JavaScript/Client-side-and-Server-side-JavaScript/2/
It means you can write server side script with JS language, but you may have to change the web server.
You can refer to :
http://en.wikipedia.org/wiki/Server-side_JavaScript
In this situation, you can use JS as language to develop, but you also have to ensure the develop platform is good enough for your product.
Lets define what is server-side script - server side scripting is programming the web-pages in such a way that they are capable serving dynamic content. Initial web was only serving static html contents. There are many server-side scripting technologies like, php, classic asp, python, asp.net, jsp and more. In case of classic asp you can have a language of your choice to code the classic asp server side pages, one is VBScript and the other JavaScript, so yes, you can do server-side scripting in javascript and render dynamic content from server-side to the client.
Once the web page is sent to client[web browsers!], the browsers also provide scripting mechanism so that the page does need to come from server for every operation, Like, rich UI management, Ajax, validating inputs and forms, taking user from one page to another, etc. Mostly this is written in javascript since all browsers support javascript. Note that Microsoft Internet explorer also support VBScript on client-side but that is not widely used since other browsers don't support VBScript. ExtJs is client-side javascript technology that leverages from rich javascript capabilities of all modern browsers. ExtJs scripts are sent from server to browser and only browser understands ExtJs and interpret into UI and Ajax actions. The server part does not come into picture only for the case of Ajax calls.
Here is my implementation https://github.com/lucassus/extjs4-account-manager/commit/8ec4e33ac8cd1fa719d358ee9e7b7706b94012f5
It's written in ruby on rails but an idea is pretty simple: you have to return an object with validation errors and handle it failure
callback, then create Ext.data.Errors
object and pass it to the form.
精彩评论