Click to return to the Essentials home page    
Web Workshop  |  Essentials

Some Code to Go with that Java?


Jeff Brown


Rafael M. Muñoz
Microsoft Corporation

March 27, 1997

The following article was originally published in the Site Builder Magazine (now known as MSDN Online Voices) "Web Men Talking" column.

Contents
We've been framed! – Creating borderless frames
Old-timers watch out – Learning Java
Say what?! – Microsoft® Agent and pronounciation
Feed me – Data access with the Advanced Data Connector
Hand-in-hand – Calling JScript™ from Java
Want it done right? Do it yourself – Looking for ActiveX™ controls
Tooting our own horn – Becoming known on the Internet

You have the questions, we have the answers.

The amazing Web Men are back -- with samples! It's better than a bakery. You can cut and paste the code, and one click will show you what it looks like. It's the icing on the cake, without all those messy crumbs. So dig in, enjoy and send your questions to the Web Men.

First, a little digression.

A few readers, who were paying more attention than you, noticed that the script snippet in the In your face answer in our last column could cause some major frustration if you didn't add some additional scripting code. You would never be able to follow the cool link! Sorry that we didn't make it clearer. We have a working page to show what we really meant.

We've been framed!

Dear Web Men:

What's the real syntax between Internet Explorer and Netscape Navigator for borderless frames? Is it FRAMEBORDER= 0|1 or is it FRAMEBORDER= YES|NO. And what's the deal with the BORDER attribute in the FRAMESET tag? Do we just do a combination of all/part of the above to get it going?

Thanks,

Lawrence Lee

The Web Men reply:

First, we want to congratulate Lawrence for being the first to e-mail us a question when the Web Men debuted last month. The topic Lawrence picked is very popular; more than 70 questions pertaining to frames have arrived in our Inbox. So read up, all you frameisters, and we'll tell you about some other places to look for information.

The FRAMEBORDER attribute can use either value, "Yes|No" or "1|0." As a good design technique, we suggest you be consistent throughout your site.

As for creating a borderless frame, you will definitely run into differences when creating pages for either Internet Explorer (thunderous applause) or Netscape Navigator (stony silence). The following code will produce a borderless frame in Internet Explorer. If you look at the same code using Navigator, you will see an annoying one-pixel border.

<FRAMESET COLS="50%,*" FRAMEBORDER=0
   FRAMESPACING=0>
	<FRAME SRC="frame1.htm">
	<FRAME SRC="frame2.htm">
</FRAMESET>

View the first sample.

If you want to hide the borders in Navigator, use the BORDER attribute: BORDER=0. Note that the BORDER=0 attribute implicitly sets FRAMEBORDER=NO. But if you leave out the FRAMEBORDER attribute, Internet Explorer will display the same border problem you saw with Navigator in the first example. Because we should be designing for all browsers, and Internet Explorer ignores the BORDER attribute, we recommend using the code below for a borderless frame.

<FRAMESET COLS="50%,*" FRAMEBORDER=0
   FRAMESPACING=0 BORDER=0>
	<FRAME SRC="frame1.htm">
	<FRAME SRC="frame2.htm">
</FRAMESET>

View the second sample.

We know of a great place for more information on frames and how to use them. The site, which contains tutorials on Frames, as well as on Forms and Tables, is Frames Tutor Non-MS link, designed by Joe Barta.

TopBack to top

Old-timers watch out

Dear Web Men:

I am 11 years old and have lots of experience on the Internet, and I know the basics of programming. I have developed many home pages and want to make them better by having applets and stuff. Do you think Java would be too hard for me to learn? Do I need lots of math experience? If you have the time, please reply.

Best Regards,

Damon Ramsey

The Web Men reply:

It's time for at least one of us to be thinking retirement, and maybe the rest of you "old-timer" hot shots should, too, with young folks like this coming up! Damon, thanks for your message. It's great to hear you're interested in learning Java. Do we think Java would be too hard for you? No. You say you already know some basics of programming and have been developing home pages, so you're heading in the right direction.

Math will always come in handy should you continue toward programming, but if you move slowly and enjoy what you are doing, you should be able to pick up Java without a problem.

The big question is "Where on the Web can I find more information?" You have tons of places to go.

At Sun Microsystems, Inc. Non-MS link check out "Where can I read about...?" Non-MS link, which contains numerous links to various material on Java. It even has a tutorial.

At Microsoft's Java Non-MSDN Online link site, visit the Visual J++™ Non-MSDN Online link site, where you can find more information on books and magazines.

Finally, there is Gamelan Non-MS link, the site of sites for Java. Here you can find more information than you'll know what to do with. Follow How-to and help Non-MS link to find more tutorials and books.

TopBack to top

Say what?!

Dear Web Men:

I have recently put up a site with Microsoft Agent. My site is a pharmacy news site and the Agent can't pronounce certain words right, like Coumadin®. But when I separate the word out like this, "cu ma din," Agent will pronounce it right. This works rather well, except that then the word is displayed in the bubble with the incorrect spelling. Is there any way to make it pronounce one word but display another?

David Harmon

The Web Men reply:

Even the current Microsoft Agent character, Genie, can get caught up in a tongue-twister now and then. Although he sometimes needs help with pronounciation, rest assured that Genie is not suffering from side effects of a prescription medication.

To display text in Microsoft Agent's word balloon that differs from what is spoken, use the MAP speech output tag. The MAP tag is used in the string passed to the Agent's Speak method. There are a bunch of other useful tags you can use to control Microsoft Agent's text-to-speech functionality, too. These are documented in the Speech Output Tags section of the Microsoft Agent Programming Interface document.

We came up with a simple sample demonstrating the MAP tag using Visual Basic® Scripting Edition Non-MSDN Online link (VBScript) to control the Agent. Since the MAP tag requires double quotes ("), and it is used within a string, you need to put in an extra set of quotes for correct VBScript syntax. Be aware that if you do not have Microsoft Agent installed on your machine when you check out our sample, you will be prompted to install it.

Note: Microsoft Agent files are 4.70MB, so they may take a few minutes to download and install. But being able to do all those groovy things with the Genie is well worth the wait.

View the Dr. Agent sample.

For all the documentation on the Agent, and to find links to public Web sites already using it, hop over to the Microsoft Agent home page. There is also a very impressive Agent resource site developed by Dov Weizman (a Level 2 member of our very own Site Builder Network). Check out the Agent InfoSpace Non-MS link site of Argo Technologies, Inc.

Remember, Microsoft Agent is still in development and is considered beta software, so things may work differently in future versions.

TopBack to top

Feed me

Dear Web Men:

I am in the process of developing a prototype intranet application. How does a client go about retrieving data from the server? I have an ActiveX tree control in my HTML page (that was created dynamically by ASP). Using VBScript, I captured the "left double click event" of a node in the tree control. In the event handler, I want to request additional data from the server (using a SQL select) and add the data to the tree. How do I go about getting data from the server?

David Tran

The Web Men Reply:

David, it sounds like you are looking for the Advanced Data Connector (ADC). This Microsoft technology enables Web pages to access records easily and efficiently from ODBC data sources that reside on the Web server or other servers connected to it.

ADC requires Internet Information Server (IIS) version 3.0 with Active Server Pages (ASP) installed, and Internet Explorer 3.01 as the client. You already are using both, based on your message. For all the ADC requirements, check out the ADC Non-MSDN Online link home page.

One component of ADC is the AdvancedDataControl. It is a non-visible ActiveX control that manages records from a database, and allows you to bind those records to data-aware, visible ActiveX controls on the page. A variety of data-aware ActiveX controls come with Microsoft Visual Basic and are available from third-party companies, including data-aware list boxes, combo boxes, grids, and text boxes.

Now, to your specific question. You could change the type of ActiveX control your ASP script is putting on the page. Use the AdvancedDataControl component of ADC and an existing data-aware control, rather than the TreeView control, which isn't a data-aware control.

If you really, really want to use the TreeView control, you can access the Recordset property of the AdvancedDataControl directly (instead of associating the AdvancedDataControl with a visible control by setting the Bindings property). But with ADC 1.0 you will be able to update records only when they are bound to a control. In other words, accessing the Recordset property directly allows you only to read fields and move through records in the recordset.

The code for your node click event handler for the TreeView could look something like this:

Sub TreeView1_NodeClick(ByVal Node)
    SControl.SQL = "select * from LabelData"
    SControl.Refresh
    Node.Text = SControl.Recordset("LabelText")
End Sub

The code above assumes the ID of the TreeView is TreeView1, that you have an AdvancedDataControl on the page with an ID of SControl, and that the LabelData table and LabelText field exist in the mydata data source. It sets the SQL property to the query string to use. Then it calls the Refresh method to refresh the recordset based on the query. Finally, it sets the text for the node to the LabelText field of the first record in the recordset.

We haven't even scratched the surface of ADC, which is an extremely powerful and flexible technology. In a nutshell, ADC enables you to build powerful multi-tier data access applications for the Internet and intranets. To find out a lot more, go to the ADC Non-MSDN Online link home page.

TopBack to top

Hand-in-hand

Dear Web Men:

I'm trying to develop an application, and I have a requirement to allow my Java stuff to interact with JScript methods. I think this is possible with Navigator and LiveConnect. Can I achieve the same, or a similar effect, with Internet Explorer?

Stewart Miller

The Web Men Reply:

It is indeed possible to get this effect with Internet Explorer and the Microsoft Virtual Machine (VM) for Java. In fact, a sample in the Microsoft SDK for Java, version 1.5 Non-MSDN Online link demonstrates this very thing. It will be in the Samples\Script Debugger subdirectory where you install the SDK. Actually, the main purpose of the sample is to demonstrate cross-language debugging using the Microsoft Script Debugger, but this is done by having JScript calling methods in Java, and vice versa.

So what does the sample do? The JScript calls a Java method, passing it the current string in the text box on the page. The Java method in turn calls a JScript function with a new string for the text box. This cross-language calling works via the Java and Component Object Model (COM) integration Non-MSDN Online link built into the Microsoft VM for Java.

TopBack to top

Want it done right? Do it yourself

Dear Web Men:

For our corporate site redesign, I'm looking for a pop-up menu control that supports a Picture property or at least a Background Color. I've tried the Ikonic Button and the PopUp Menu objects, to no avail. Help! Thanks.

Brian Wachter

The Web Men reply:

New ActiveX controls are coming out every day, and you have found one of the newest, Brian -- the Ikonic Button. Okay, everyone: Three guesses as to where Brian ran across this nifty control. Did you say "Site Builder Network site?" You're right. The only problem with this control is that it has not been documented yet. We have received mail from other readers who are successfully using the control, but we recommend waiting for the formal documentation.

But, as you have already figured out, this control doesn't support a Picture property or a Background Color at this time, and neither does the PopUp Menu control. We went looking. In truth, right now it's pretty slim pickings for this type of control. One great place to look for ActiveX controls is the COM Web site, but we were unable to find what you request. Another great place is part of the C|Net site, ActiveX.com Non-MS link, which features a convenient search option for finding ActiveX controls. But alas, even with a search engine, we were unable to find the specific type of control you seek.

Remember the old saying? "If you want something done right, do it yourself." The same thing might apply here. Why don't you make your own control? You can use the Microsoft Visual Basic Control Creation Edition, available from Microsoft, and you can find information on this application at the Visual Basic Building Controls Non-MSDN Online link site. This would be a great tool to download and would put you on the right track to creating exactly what you are looking for.

TopBack to top

Tooting our own horn

Dear Web Men:

This may be a stupid question, but how can I get my site listed on one of the many search engines, such as Webcrawler or Alta Vista? Is there a message I can send somewhere, or do I just wait until it is "discovered" somehow?

Thanks for any help,

David Midgarden

The Web Men reply:

Now, David, what did your teachers always say in school? "The only stupid question is the one you don't ask." No, really, thanks for asking, David. It's a great question, because we get to "toot our own horn" here.

There are many different search engines, directories, and online catalogs. For a list, you can go to various search sites such as AltaVista Non-MS link or Yahoo! Non-MS link.

All these search engines, directories, and online catalogs provide ways to submit your URLs so that others surfing the Web can find you. So what is the problem with this? Nothing -- except that there are so many you'll grow old trying to get registered everywhere (We all have better things to do, right?)

That's where the magic of the Internet comes in. Many companies on the Web will submit your URLs for free or at minimal cost. The breadth of distribution for your URL will vary according to the fee. For no charge, you will usually get 16 or more submissions, and for the minimal fee you can get submitted into more than 200 different search engines, directories, and online catalogs. For a quick list of companies that provide services like this, see Yahoo!'s Announcement Services for the Web Non-MS link.

Jeff Brown, when not forcing family and friends to listen to Zydeco and country blues music, provides technical support for the Microsoft MSDN Online with a smile.

Rafael M. Muñoz is a part-time Adonis, and full-time support engineer for Microsoft Technical Support. He takes it very, very personally every time you flame Microsoft.

Write us!



Back to topBack to top

Did you find this article useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.