000706.html | WebReference

000706.html

((((((((((((((((( WEBREFERENCE UPDATE NEWSLETTER ))))))))))))))))) July 6, 2000

_____________________________SPONSORS_____________________________

This newsletter sponsored by: Searchbutton and Affiliate Solutions __________________________________________________________________

******************************************************************

Search-enable your site for FREE today! Fully scalable and customizable, nothing to install or maintain, and fully integrated into your site. Interactive search reporting and site management. Sign up is quick and easy - go to https://www.searchbutton.com today!

************************************************************adv.**

https://www.webreference.com https://www.webreference.com/new/ https://www.webreference.com/new/submit.html New this week on WebReference.com and the Web:

1. OPEN PUBLISHING: Submit & Win XMetaL 2.0! 2. FEATURED ARTICLE: SOM - Your New Baby 3. NET NEWS: * XML Linking Standards Move Forward * Wireless: Unplugged and Insecure * Glitches Let Net Shoppers Get Free Goods

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. OPEN PUBLISHING: Submit & Win XMetaL 2.0!

Every Thursday the Update features a new article contributed by our readers through our Open Publishing Initiative. We encourage you to submit your own article ideas. Your words could be here!

And now when you get your article published, you not only earn the eyeballs of almost 100,000 readers, but also a copy of the hot new XML editor from SoftQuad, XMetaL 2.0!

https://www.webreference.com/new/submit.html

This week, writer Gordon Rose returns with a look at the SOM, Microsoft's scripting object model, and shows you how to nurture this technology in a bundle of Web development joy. Thanks Gordon, and enjoy your copy of XMetaL 2.0!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2. FEATURED ARTICLE: SOM - Your New Baby

For a Web developer, discovering the scripting object model, or SOM, is a lot like having a brand new baby dropped in your lap - it's new, beautiful, and exciting, but unfortunately, it doesn't come with any directions. So you, the doting Web developer, strive to learn how to work with this wonderful addition through trial-and-error, and wind up with a lot of sleepless nights! Where is Dr. Spock's guide for making the SOM a mature member of your family of development technologies? I can at least tell you that the first chapter is right here. My goal in this article is to make you familiar with the SOM, and in the process show you the incredible capabilities it can add to your Web projects. I'll also be sure pass along a couple of tips I've discovered - while chugging coffee and listening to the late, late show in the background.

The SOM originally shipped with little fanfare as a part of Visual InterDev 6.0 from Microsoft. Users of other tools generally haven't heard of it or seen it. Even VI users typically work with the SOM indirectly, by using VI's design time controls (DTCs). In reality, the SOM has a lot to offer all Web developers, and its usefulness goes far beyond the role of providing the underlying functionality for VI's DTCs.

First, a quick note - if you haven't run into DTCs, they are simply regular-old ActiveX controls with a special interface for generating text. The text they generate is typically source code that would otherwise be challenging (and tedious, given the amount of it) for you to add yourself. They can be used in development tools other than VI, though the DTCs that ship with VI are designed specifically for use in VI. For example, in Visual Interdev, it's easy to drop a Recordset DTC on a Web page and then add database connection and record source information, such as a connection string and a SQL statement or table name.

So, you ask, what's in it for me (other than the pure entertainment value, or course)? Well, you could add a textbox DTC and then bind the control to the Recordset DTC. The two would work in tandem to insure that the textbox is populated with the correct information from the recordset and that the recordset is updated when a user changes the content of the textbox. It's saving those hours of otherwise hand-coding the stuff that's in it for you! There's a corresponding DTC for every standard HTML control, and they can be placed on either ASP pages for cross-browser functionality, or on DHTML pages for IE 4.0+-only applications. Tying this all back to the SOM, the text generated by the DTCs consists of server-side and client-side script blocks from which calls to SOM routines are made. In the case of cross-browser pages, those routines build and manage the objects using standard JavaScript and HTML. Pretty neat!

That's a glimpse of the Rapid Application Development, or RAD, side of the SOM and of DTCs. The inspiration for the SOM goes further, and was none other than the rich, event-driven paradigm of client Web-pages provided by the document object model (DOM) and Dynamic HTML (DHTML). If you think about it for a second, how many events are intrinsic to the ASP environment? I can think of four: the OnStart and OnEnd events of the Session and Application objects. Wouldn't it be nice to have a rich set of events just as you do in your client pages? Another brainteaser: how do you control the flow of code execution in your ASP pages? The answer: you don't, except for when you explicitly call functions and subs, or include inline server code. Microsoft steadfastly insists in numerous documents that ASP developers must not rely any particular order of execution of ASP code, because they don't guarantee it! Wouldn't it be nice if you could? And even better if you could make a distinction between the first time a user hits your ASP page and all subsequent hits to the same page by the same user? With the SOM, you can do all of this, and more. Hey, our baby's starting to smile and coo a little bit!

Let me spend just a moment more on how the SOM works. The SOM is a library of JavaScript code usually installed in a folder named ScriptLibrary and placed directly below the Web application root (directly below the IIS virtual directory configured as an application. Tip: You will need to be careful where you place pages that use the SOM if you disable parent paths in your application as DTCs use relative paths when placed on a page at the same level or below that of the ScriptLibrary folder.).

The SOM also includes a Java class that provides the glue needed to make what are essentially remote procedure calls between client- and server-based pages (that's a little beyond the scope of this article, but yes, you can make calls from client pages to server pages and retrieve the results of those calls without leaving the client page to perform a round-trip). It is not necessary to have Visual Interdev to use the SOM. A complete copy of the SOM can be downloaded from Microsoft, at (https://msdn.microsoft.com/scripting). This is a site all Web developers should visit early and often (in addition to, of course, WebReference.com). I'll focus on using the SOM in ASP pages, as most developers seek to create cross-browser compatible pages.

******************************************************************

Affiliate Solutions Seminar – New York City You'll learn inside secrets from industry leaders and successful online marketing companies. AS 2000 features panel discussions focusing on revenue sharing and affiliate strategies. Sept. 27, 2000 at the Marriott Marquis Hotel. https://seminars.internet.com

***********************************************************adv.***

First, to use the SOM in an ASP page, you must first "turn it on." This is done via a server-side include of the appropriate .JS file from the SOM itself, followed by a function call, as follows:

Also note that the entire HTML document is encapsulated in a form called thisForm defined with a method of POST. Any HTML controls you place on the client page will be a part of this form and their values will be sent to the server whenever the page is submitted. The thisForm is automatically submitted by several of the SOM routines and is integral to its functioning. One trick of using the SOM is learning how to trigger the submission of the form at will while preserving the context and behavior of the SOM, even from other client pages as might happen when using frames. But first, let's finish our look at "turning on" the SOM in an ASP page.

When an ASP page is retrieved from IIS, the Web Application Manager creates an object, known as the Page Object - (now you VI users know where the name for the Page Object DTC control comes from) - and the Page Object in effect represents the particular instance of the execution and processing of the retrieved ASP page. For more information on this, see the excellent article on IIS architecture in MIND magazine at https://www.microsoft.com/mind/1099/inside/inside1099.htm (a must- read if you do ASP development). You can also find two excellent articles in the MIND archives from 1998 and 1999 which deal exclusively on the SOM. A useful MS KB article lays out the sequence of trappable events when using the SOM. Finally, Mobil Tape (www.mobiletape.com) sells a presentation from the 1999 TechEd on advanced use of the SOM that is well worth the $25 or so.

Back to the SOM, the call made in our example code above results in the creation of the all-important thisPage object, a server- and client-addressable object that represents the current instance of the ASP page. thisPage comes with some extremely useful events, such as OnEnter, which fires at the very beginning of server-side ASP page processing. As a result, any code you place in this event will be the first code executed on the page. Voila! Control over the order of execution! (You can place server code above that block using the Furthermore, thisPage has a property called firstEntered, and you probably just guessed its tremendous value. It tells you whether a client is loading your ASP page for the first time. That means you only have to run start up code once! The list goes on... there's an OnExit event, etc. You get the picture. Your ASP pages are now orders of magnitude more powerful and manageable. It gets better, as you can "reference" one ASP page from another, the same way you reference, say, the ActiveX Data Objects library in a VB project. The routines in the referenced page become available to the referencing page. They in effect define "entry points" in the referenced ASP pages, and can be accessed by the referencing page without leaving it, or can be accessed by navigating to the referenced page and beginning page execution in the called routine!

Let's turn to the client for a moment. Once again, the client page is encapsulated in a giant form called thisForm. The SOM automatically includes a number of hidden fields in thisForm and adds JavaScript code to the page as well to coordinate the activities of client and the server within the context of the SOM. Normally, the client posts back to the server whenever the user clicks on a DTC button and there is a handler for the click event on the server (yes, the event handlers for the DTC controls are on the server in cross-browser pages, and there are other events which cause the client to post as well).

You don't have to wait for the user to click a DTC button to post the form however. You can execute the underlying code yourself. I often use nothing more than a page object and a hidden DTC button object to get all the benefits of the SOM without exposing any of it to my users. That way, I get all the functionality of the SOM, while maintaining complete control from a DHTML point of view. Again, we could go on and on, but the idea here is mainly to provide a level of familiarity with what the SOM has to offer you.

Other valuable benefits of the SOM include the creation and management of page-level properties that can be defined as read- write on both server and client. You could define a page property on the server, initialize it in the "Sub thisPage_OnEnter... If thisPage.firstEntered Then... End If End Sub"-style event handler, modify it on the client, and examine the modified property value in a subsequent round-trip to the server.

As you can see, the SOM delivers a lot. Any serious Web developer would be crazy to ignore this stupendous functionality. Never knew that kid was going to be a Rhodes Scholar, did you? The decision to use DTCs is another issue, as that involves, as I understand it, licensing a copy of Visual Interdev (you can create the DTCs yourself in client code if you want to, and that doesn't require licensing the ActiveX objects themselves). I recommend it, while recognizing you may have settled on an ASP development, data- binding solution of another type and flavor -- GoLive (which uses the SOM, by the way), Cold Fusion, JSP, the new UltraDev, etc. No matter what tool you use, your entire development effort will be enhanced by understanding and using the SOM.

******************************************************************

FREE JAVA SCRIPTS AVAILABLE FOR USE ON YOUR WEBSITE… Visit the ultimate resource for hundreds of free Java Scripts available now at https://javascript.internet.com. You will find these scripts via a user-friendly interface including a working demonstration of all the scripts and a text box with the actual Java Script coding used. Visit https://javascript.internet.com

***********************************************************adv.***

About the author:

Gordon Rose is the lead developer of ActiveCert.com, a site that helps MCSEs upgrade their certifications to Windows 2000. He invites all readers to visit www.activecert.com and take a free practice mini-test. Gordon holds the MCSE, MCSD, MCDBA, MCT, and MCP+I Microsoft certifications. This is Gordon's second article for Webreference.com.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3. NET NEWS: XML Linking Standards Move Forward, Wireless: Unplugged and Insecure, Glitches Let Net Shoppers Get Free Goods

>XML Linking Standards Move Forward

The World Wide Web Consortium this week moved to standardize XML hyperlinks. XML Linking Language (XLink) Version 1.0 allows elements to be inserted into Extensible Markup Language (XML) documents to create and describe links between resources, allowing for structures that can not only describe links similar to the simple unidirectional hyperlinks of today's HTML, but go well beyond. https://www.internetnews.com/wd-news/article/0,,10_409241,00.html InternetNews.com, 000706

>Wireless: Unplugged and Insecure

The industry is rushing to wireless as it did to the Internet, and it's making the same hurried mistakes regarding security: minimizing its importance in order to get applications into the hands of users. https://www.zdnet.com/zdnn/stories/news/0,4586,2597657,00.html ZDNet.com, 000706

>Glitches Let Net Shoppers Get Free Goods

The Fourth of July meant freedom from paying for goods at some online sites, where botched coupon deals let shoppers waltz out with free or nearly free deals. https://news.cnet.com/news/0-1007-200-2208733.html CNet.com, 000705

That's it for this week, see you next time.

Andrew King Managing Editor, WebReference.com [email protected]

Eric Cook Assistant Editor, WebReference.com [email protected]

Catherine Levy Assistant Editor, WebReference.com [email protected]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ For information about advertising in this newsletter, contact Frank Fazio, Director of Inside Sales, Jupitermedia Corp. Call (203)662-2997 or write mailto:[email protected] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ This newsletter is published by Jupitermedia Corp. https://internet.com - The Internet Industry Portal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ To learn about other free newsletters offered by internet.com or to change your subscription - https://e-newsletters.internet.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ internet.com's network of more than 100 Websites are organized into 14 channels... Internet Technology https://internet.com/sections/it.html E-Commerce/Marketing https://internet.com/sections/marketing.html Web Developer https://internet.com/sections/webdev.html Windows Internet Technology https://internet.com/sections/win.html Linux/Open Source https://internet.com/sections/linux.html Internet Resources https://internet.com/sections/resources.html Internet Lists https://internet.com/sections/lists.html ISP Resources https://internet.com/sections/isp.html Downloads https://internet.com/sections/downloads.html International https://internet.com/sections/international.html Internet News https://internet.com/sections/news.html Internet Stocks/VC https://internet.com/sections/stocks.html ASP Resources https://internet.com/sections/asp.html Wireless Internet https://internet.com/sections/wireless.html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ To find an answer - https://search.internet.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ For information on reprinting or linking to internet.com content: https://internet.com/corporate/permissions.html ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ Copyright (c) 2000 Jupitermedia Corp. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~