I’ll expect that you as of now have Dreamweaver and Java introduced and working; I will not be expounding much on Dreamweaver or Java separately, zeroing in rather on the association between the two.
Why Connect to Java?
I’ve utilized Java from Dreamweaver to store part formats in diligent Java objects (see Figure 1). Essentially, I keep segment “classes” in Java and make Dreamweaver part “objects” from those classes. This is near the JavaBeans model. By keeping the class properties covered up, I uncover just certain properties to be changed for a given part example through Dreamweaver’s “property overseer” system. Along these lines, various degrees of segment customizations can be made accessible at various occasions or for various undertakings. I can likewise control the HTML produced for a part by delivering the HTML for a page from the Java classes. This gives me the adaptability to change the presence of a part and its conduct – without changing the segment occurrence, which may have been utilized on numerous pages.
Also, Java permits generally simple admittance to our substance the board framework (CMS) through JDBC. The CMS is executed in a Sybase data set. Parts that incorporate critical substance (say, a section or more) can reference the content in the CMS at page configuration time. The Dreamweaver client can pick the substance continuously by utilizing a custom Dreamweaver object with a custom property reviewer.
In the first place, ensure Dreamweaver is introduced effectively. Spot the document EchoTest.html in the Dreamweaver catalog Configuration/Commands. (In a standard establishment, the Dreamweaver registry is at/Program Files/Macromedia/Dreamweaver 2.) After you start Dreamweaver, you should see EchoTest in the Commands drop-down menu; select it. You’ll get a mistake message about DWjavaio not being characterized; that is the library you’ll make.
Then, ensure Java is introduced accurately. Your CLASSPATH climate variable ought to incorporate a . for current index. Spot the record EchoTest.java from Example 1(b) into the Dreamweaver 2 index, and arrange it with javac. The primary technique is only for testing; run your class with java EchoTest. On the off chance that everything is set up appropriately, you’ll see the test message.
We’ll build the fundamental DLL in two phases: first we’ll simply associate with Dreamweaver to ensure we have that interface working, at that point we’ll add the Java association.
You’ll have to get the “Broadening Dreamweaver” documentation bundle from the Macromedia site (right now at www.macromedia.com/support/dreamweaver/expand/dream2extend.html); both Mac and Windows renditions are accessible. The bundle incorporates an Adobe Acrobat specialized report, test code, and the interface record mm_init.h. The bundle does exclude parallel code due to the manner in which Dreamweaver will call your DLL.
I’ve utilized just Microsoft Visual C++ to construct the DLL, yet since we needn’t bother with Microsoft augmentations or structures, you ought to have the option to work with any compiler that can focus on a Windows DLL. Since Dreamweaver and Java are additionally accessible on Macintosh, Mac clients ought to have the option to apply the vast majority of the source code in this article, however explicit form and establishment steps will presumably vary.
To make the main DLL, make another registry and spot DW2J1.c from Listing One in it. Duplicate mm_init.h from the Extending Dreamweaver bundle. Assemble and connection to DWjavaio.DLL. Duplicate the new DLL to the Dreamweaver 2\Configuration\JSExtensions index. Restart Dreamweaver, and select EchoTest from the Commands pull-down menu once more. The alarm message ought to affirm that you made the full circle to your new DLL.
Since we know the Dreamweaver-to-DLL association is working, we can include Java along with everything else. We’ll utilize the Java Native Interface (JNI), which is essential for the JDK. I’m utilizing JDK rendition 1.1.6, while the most recent creation adaptation is 1.2.x (a.k.a. “Delivery 2”). I don’t know about any regressive similarity issues to the 1.1.6 JNI, so on the off chance that you utilize 1.2 you ought to be fine. JNI allows you to call Java techniques from C capacities and carry out Java classes in C. Since every one of our communications with Java start from Dreamweaver, we just need to stress over calling Java from C. See the JDK documentation for more data about JNI; note that the JNI archive (reasonably) centers on composing Java classes in C, so you’ll need to search for the C-calls-Java parts. Segment 4 of the JNI archive is the most helpful as a kind of perspective.