trinity mail wrote:
if i have both server side and client side script in a web application,
will the resulting application run as a client or server?...
The resulting application will "run as" neither client nor server. It will
run the server-side code to produce some content which is sent to the
client. If the resulting content contains client-side Javascript, then that
Javascript is executed on the client (assuming the client understands how to
execute client-side script).
Liza, we will call it server side. Because the server side script is
beyond our abilty to manipulate we think of the entire page as server
side.
This makes entirely no sense to me.
If this is the case, then _all_ Web pages are "server side" (which is true
given the definition above), because you have no ability to edit the static
HTML pages (on the server) sent to you either.
You have to separate your thinking into "what happens on the server" and
"what happens on the client".
Starting with the client first (because I hope it will make more sense to
you this way): the client makes a request to a Web server and receives some
"text/html" content from a Web server (it can receive other types of
content, but let's keep it simple with text/html). It does not matter if
that content is a static HTML document, it was generated by some server-side
processing (such as ASP, JSP, or PHP) or if there are 1,000,000 monkeys
tapping away at keyboards on the server. The client just sees "text/html"
and renders it. If that "text/html" contains client-side <script> tags (of
type "text/javascript"), then maybe that client-side script is executed,
maybe it isn't. But the client doesn't care _how_ the content was generated,
as far as the client is concerned it's all just static HTML pages.
Now for "what happens on the server". The server receives a request for
content and serves it to the client. It may do this by reading and sending a
static HTML page, it may do this by executing Perl, or reading and
interpreting PHP or ASP. It may do this by loading a servlet and running it
inside a Java Virtual Machine or it might shock 1,000,000 monkeys with
electricity to make them start typing. _It does not matter_. The end result
is a document of type "text/html" sent to the client. This document may or
may not contain content of type "text/javascript" between <script></script>
tags. _The server does not care_, it just sends it to the client.
HTTP is not an interaction which is typically called a client/server
application, where a client and server keep a connection between each other
open and can communicate bi-directionally anytime they wish. HTTP is a
"stateless" transaction, and in it's simplest form, data can only travel in
one direction at a time. The client makes a request, the server receives the
request and responds to the request. After that transaction takes place,
neither the client nor the server know or care if the other is still there.
In fact, the server doesn't even care if the client ever receives or
understands the data sent to it.
--
| Grant Wagner <gw*****@agricoreunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html