[ Pobierz całość w formacie PDF ] .We now still need to make a few connections.For the AdapterCommandGroup, we mustassign its DisplayComponent property to point to the AdapterFieldGroup.The only thingleft now is to make sure that the AdapterFieldGroup connects to the dsaBiolifeTDataSetAdapter (from the unit wDataMod).To do so, we must first include the headerof the wDataMod unit to the current unit (for example, using Alt+F11 or File, IncludeUnit Hdr.), and then assign the Adapter property of the AdapterFieldGroup toWebDataModule1->dsaBiolife to make the final connection.DeploymentBefore you can deploy WebSnap applications on a Web server (machine), there aretwo special files that have to be installed and deployed on that machine first.Formore information, you should always read deploy.txt in your CBuilder6 directory.Basically, you must register WebBrokerScript.tlb as well as stdvdl40.dll on the Webserver machine using tregsvr.exe all found in the CBuilder6\bin directory.Also,WebSnap applications require the Microsoft Active Scripting Engine, which isincluded in IE5 and later, and installed on Windows 2000 and later (but if it s not onyour Web server, you can download it from http://msdn.microsoft.com/scripting).And finally, you must ensure that the XML files that the ClientDataSets are usingare also available on the Web server (if you remove the PATH portion in the FileNameproperty, then you can put them in the same directory as your Web serverapplication).27 0672324806 CH22 12/12/02 2:39 PM Page 844844 CHAPTER 22 Web Server Programming with WebSnapAfter these preparations, let s turn to the CGI.exe project.By default, all C++Builderprojects have their options set to generate small executes, by using the dynamic RTLas well as runtime packages.However, this results in additional files that you have todeploy on the Web server.And, because I do not want to do that (I always want tolimit the number of files that I have to deploy), we should start the Project, Optionsdialog.On the Compiler tab, click the Release button; on the Linker tab, uncheckthe Use dynamic RTL option, and finally on the Packages tab, uncheck the Buildwith runtime packages option.Now, do Project, Build CGI to build the project.Thisshould result in a CGI.exe of 2,096,128 bytes mainly caused by the fact that thewDataMod.dfm is 2,487,537 bytes big if the ClientDataSet is open at design time (sothe data is made persistent inside this.dfm file).But, even without an activeClientDataSet, the WebSnap executable will still be over one megabyte in size.Without having written one line of C++ code!Anyway, we now need to deploy both the executable CGI.exe as well as all.html files:pmHome.html (for the Home page) and pmBiolife.html (for the biolife Page Module).These two.html files are the ones that can be modified using Dreamweaver orFrontPage.Deploying the files means moving them to the cgi-bin or Scripts directoryof your Web server.If you do this on your local machine, the URL to view theCGI.exe can be something like http://localhost/Scripts/CGI.exe or http://localhost/cgi-bin/CGI.exe.You can view the results of the CGI.exe in a browser and get themain home page, which is still empty because we didn t do anything special withthe TPageProducer component on the main WebModule, see Figure 22.9.FIGURE 22.9 CGI.exe.Next to the home page is a link to the Biolife page, and when you click it, you getthe real results of the WebSnap application, as can be seen Figure 22.10.Remember that we added all fields to the DataSetAdapter, which explicitly includedthe Graphic field.If we hadn t made sure to add all fields at that place, the Graphicfield would not have been part of the displayed fields (even if by default you get allfields when you didn t select any).My best guess is that it s part of some helpfuldefault optimization rule.27 0672324806 CH22 12/12/02 2:39 PM Page 845WebSnap Demo 845FIGURE 22.10 Output of WebSnap application in Internet Explorer.TweakingWe haven t yet written a single line of C++ code.But this is about to change becausewe do need some tweaking at this point.The project source code that has beengenerated so far contains a little bug that prevents the command buttons from oper-ating.Click the NextRow or LastRow button and you ll see what I mean we are stillat the first record! Believe me when I tell you that the problem is not related to thefact that we have been building CGI standalone executable targets because you willalso be unable to move to the next record with an ISAPI Dynamic link library or aWeb App Debugger executable.The problem has to do with multipart requests, and specifically the ReqMulti
[ Pobierz całość w formacie PDF ]
zanotowane.pldoc.pisz.plpdf.pisz.plhanula1950.keep.pl
|