My Profile

Friday, January 21, 2011

Combining JavaScript with Other Languages


There are some situations where JavaScript really shines-and as you've learned, there are some where it doesn't even come close. Although JavaScript may be improved in the future, the current solution is to use the right tool for the job. Several Web languages can be used in combination with JavaScript.

JavaScript and Java


Java, the "big brother" of JavaScript, is the most obvious choice to use if you need to fill in some of the holes in JavaScript. Java includes many features, including communication across the network and graphics capabilities.
Java is harder to learn than JavaScript, but you may not need to learn it. Many ready-to-use Java applets are available. You will find several of these on the CD that comes with this guide.
Best of all, JavaScript includes features that enable it to be tightly integrated with Java. You can use a Java applet and use JavaScript to control its features. 

Tip
Remember that JavaScript can do many things Java can't do-including modifying HTML during its display, validating forms, and handling user-generated events.


JavaScript and CGI


Common Gateway Interface (CGI) has been a standard almost as long as the Web has, and it can be used to make Web pages interactive. You encounter CGI all over the Web-anywhere you fill in a form and press a Submit button, you've accessed a CGI script.
CGI is not actually a language, but rather a standard interface. You can write CGI programs in any language. The most commonly used languages for the task are Perl and C.
CGI is different from Java or JavaScript in that it executes entirely on the server. Your client sends information to it in the request and then receives the results in the form of a Web page. You cannot have instant results-such as a total that automatically updates as you change the numbers entered. Combining JavaScript with CGI gives you the best of both worlds.

JavaScript and SSI


An alternative to CGI is Server-Side Include, or SSI. This enables you to include dynamic data in a page, similar to JavaScript's capability, but it happens on the server side.
Like CGI, SSI is a standard, and you can use any language to program SSI. You can combine SSI and JavaScript to make a truly dynamic page. You can even use SSI to change the JavaScript code included in the page based on certain factors. 
Unfortunately, although most Web servers support SSI, not all systems (or system administrators) allow their use. The main reason for this is that each Web page has to be parsed for SSI instructions, which slows down the server. There are also security concerns. Ask your system administrator whether you are allowed to use SSI. 

----------------------------------------------------------

** If you like this post please like our page in facebook

0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More