advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

JavaBoutique : Articles :

An Illustration of these Techniques

Contents
Introduction
Intro pt 1
Intro pt 2
Intro pt 3
Intro pt 4
An Illustration of these Techniques
An Applet Example
An Active X Example
A Pseudo-Constructor Example
Pseudo-Constructor pt 2
Applet Persists Indefinitely; Breaks into JavaScript
Persistence
Conclusion

3. A Pseudo-Constructor Example

This is because it is independent of what happens to the pages – when created it is tied to the JAVA virtual machine, through the static variables, and then never destroyed. This demonstrates that we have moved a stage further in establishing persistence. Since the frame is only created once, there are none of the stability problems that were previously associated with the Abstract Windows Toolkit. Transition between pages is essentially instantaneous; whenever access to the underlying HTML is desired, then the very small source applet is simply reloaded on that page. It provides the link to ShopPanel, from the underlying HTML.

Incidentally, if you look closely, you will notice that ShopPanel this time is not an abstract class. A pseudo- constructor for an abstract class must follow a very specific initialization procedure in order to work. It turns out that if the same sequence is followed within a normal class - using the same static variables and static methods – then this also leads to an object that ‘lives forever.’ However, a normal class can contain a constructor, and thus it can do more things. We have come further.

The two methods for creating persistence (reloading and pseudo-constructors) cooperate beautifully. Our shopping cart, for instance, is created once, and then never destroyed. Applet reload gives it continuing access to the underlying HTML, through Javascript and LiveConnect, and through the applet lifecycle, which can pass current context information to the persistent class. Creation of the shopping cart can occur on any of the pages that are being reloaded – one simply sets a boolean variable ‘firstTime’ to true in the initialization statements in ShopPanel, and when the frame is created, one resets it to false. The change in the variable is remembered at a reload; the frame is created only when ‘firstTime’ is true.

The material that we have covered thus far is extracted from a patent that covers HTML memory and pseudo-constructors (Patent Pending acquired Sept. 13, 1999 and January 7, 2000), and the application of these techniques to a shopping cart and a database cache. My goal is to sell the shopping cart. Obviously, there will need to be discussion at some point as to what portion of these techniques can become public domain, and what core needs to be restricted to maintain cart functionality.

Now for some fun. Once one has a program that can ‘live forever,’ then it is possible to do some interesting things. For instance, one can break into the JavaScript interpreter on various pages. To demonstrate this, I’ve extended the shopping cart to use JSObjects. If the JSObject class is new to you, you might wish to look at http://vdrea.da.ru/tech/jscript-dg/ch19_06.htm. The basic difference in the shopping cart code is that I now jump to various pages through the use of (JSObject) JavaScript win.call(“open”,args[]), rather than through the use of applet.getAppletContext().showDocument(). I also use win.eval(“status=’message’”).

As you will see, anything that goes ‘off site’ is a bit brittle, and probably not suitable for final version software. Also, on some versions of Netscape, you will also see that data is no longer being added up from page to page ­ rather, a new cart is formed for each page - the very fact that we use the word MAYSCRIPT forces a reload rather than a reactivation of the applet. Since we are now talking about breaking security limits, I’ve also changed the style of my presentation.

Next ->


Lane Friesen

lanelise@dowco.com

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

 Microsoft Visual Studio 2010 Showcase
 Avaya Developer Showcase
 MSDN Spotlight
 PHP for Windows Showcase
XML error: undefined entity at line 39
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Windows 7: From Beta to Final Code in One Year
Google Shows Off Chrome OS, Releases Source
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?
Fedora 12 Takes Aim at Linux Networking
Top Supercomputer Nearly Doubles in Speed
Fedora 12 Linux Tackles Virtualization
Apple Gives iPhone Developers App Status Tracker
Novell Sets OpenSUSE 11.2 Free

Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Exploring HTML 5's Audio/Video Multimedia Support
Overriding Virtual Functions? Use C++0x Attributes to Avoid Bugs.
Understanding the Cloud Computing Security Vulnerabilities
Cisco and IBM Target a Greener World
Upgrade to Visual Studio 2010 with the Ultimate Offer

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs