--- On Thu, 12/18/08, elyes sallem wrote:
> so if an action is a html for you, sorry, but now i'm too busy to 
> explain to you the difference

No, the action is the Java part. The HTML part is generated by the JSP 
page--this is also where the JavaScript layer lives.

Unless you're writing an applet there is *no* Java on the client side (ignoring 
GWT for the moment, which compiles to JavaScript anyway). 

There's no Swing on the client side of a web application (ignoring applets 
still), and it wouldn't make any sense on the server side.

Here's a primer:

- Client side is the browser.

- Client makes a request to the server.

- The server responds to the request--server-side code can be written in any 
language supported by the JVM, but for the sake of argument, we'll say it's 
written in Java. The JavaScript article that you linked to, as was pointed out, 
is about using JVM-based JavaScript, which has *nothing* to do with the client 
side (the browser).

- The server Java code at some point generates HTML: the de facto way of doing 
this is via JSP (which lives on the server side). JSP code is compiled to Java 
code as well (on the *server*), when executed the code generates HTML.

- The HTML is sent to the client (the browser). The HTML may include JavaScript 
code. This JavaScript code is executed *on the client*, in the browser 
environment. This is where the user interface is rendered, no matter what the 
UI looks like--simple things like forms with text boxes, or complicated things 
like full-blown RIAs (Rich Internet Applications) that look like desktop 
apps--all running JavaScript on the *client side* (the browser) and 
communicating with the server via HTTP.

So when ask things like "how do I call JavaScript from an Action" it doesn't 
make any sense to us--because you can't do it (more or less; things like GWT 
and DWR can somewhat blur the line between client and server).

You can generate HTML (say, via JSP) that contains JavaScript, and when the 
page is rendered that JavaScript can be run, but you don't directly call 
JavaScript (on the *client*) from an Action (on the *server*).

That's why people are suggesting to read up on web application 
programming--there are some fundamental concepts that should be understood 
before walking too far down that path. That you were trying to implement 
functionality via Swing shows us that there are some very fundamental 
misconceptions that should be cleared up before getting to Struts-specific 
topics, which is what this newsgroup is for.

HTH,
Dave

PS: To everybody else: see? I can be nice :p

:D


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to