The process class is the one that actually handles the incoming request. The Wizard generated this class, which is essentially a template to which we can add new methods, for us. The generated class looks like this. Note the HelloWorld method:
************************************************************************ *PROCEDURE WebProcess **************************** LPARAMETER loServer LOCAL loProcess PRIVATE Request, Response, Server, Session, Process STORE .null. TO Request, Response, Server, Session, Process #INCLUDE WCONNECT.H loProcess=CREATE("WebProcess",loServer) loProcess.lShowRequestData = loServer.lShowRequestData IF VARTYPE(loProcess)#"O" *** All we can do is return... WAIT WINDOW NOWAIT "Unable to create Process object..." RETURN .F. ENDIF *** Call the Process Method that handles the request loProcess.Process() RETURN ************************************************************* DEFINE CLASS WebProcess AS WWC_PROCESS ************************************************************* cResponseClass = [wwPageResponse40] && Original generated: [WWC_PAGERESPONSE] ********************************************************************* FUNCTION TestPage() ************************ THIS.StandardPage("Hello World from the WebProcess process",; "If you got here, everything should be working fine.<p>" + ; "Time: <b>" + TIME()+ "</b>") ENDFUNC * EOF WebProcess::TestPage ENDDEFINE
I actually stripped out a couple of things that aren't important right now. Basically what we have here, is our request class with a HelloWorld method that's called when the request hits. Every method that you create can be accessed through the Web page by using either the Method.wp or wc.dll?WebProcess~Method syntax.
*** Use Classic Response object functions for this old class cResponseClass = "wwPageResponse40"
This covers methods Response.FormTextbox, Response.FormHeader etc. which no longer existing with the wwPageResponse class.
************************************************************************ * WebDemo :: CustomerList **************************************** FUNCTION CustomerList() *** Run a static query SELECT company, careof as Name, address, phone ; FROM wwDemo\TT_CUST ; ORDER BY Company ; INTO CURSOR TQuery *** Create HTTP Header, HEAD section, HTML/BODY tags and header text Response.HTMLHeader("Customer Data Accces") Response.Write("This demo displays data from a customer file.<p>") loSC = CREATEOBJECT("wwShowCursor") loSC.ShowCursor() *** Write the output from the ShowCursor Object to the Web Response.Write( loSC.GetOutput() ) *** Generate </body></html> Response.HTMLFooter() RETURN
Then run:
http://localhost/CustomerList.wp
http://localhost/WebDemo/wc.dll?WebProcess~CustomerList
Make sure that the Web Connection server is running as before. When you do this you'll get a result like this:

Pretty cool, right? With a couple of lines of code, we've run a request on the server and have displayed the result of a Web query, and we really haven't written any HTML specific code. Note that you can however, write raw HTML code very easily, simply by using the Response.Write() method.
Let's look a little close at what that code does. We start with a plain VFP SQL query that generates a cursor. Next we start to build an HTML document using code. The Response object is used to handle all HTTP/HTML output to the Web server. The Write() method is the lowest level method that sends output directly to the output stream. Above I use the Write method to write out a simple text string that's displayed in the document:
Response.Write("This demo displays data from a customer file.<p>")All the other methods used in this request are higher level methods that generate compound HTML with single method calls. HTMLHeader() is a routine that creates a typical header for an HTML document. It generates a default HTTP Header, an HTML <HEAD> section containing a title, the <HTML><BODY> tags and some HTML that writes out a string in big text as the display header of the HTML document.
The most interesting code of the request above is the ShowCursor object and calls, which are responsible for taking the currently open cursor or table and rendering it into an HTML document. It basically runs a SCAN loop through the data in TQuery (the open cursor) and generates an HTML table row for every record it finds. The result is the HTML table output above. One line of code can be very productive in generating a lot of HTML - ShowCursor() is great for quickly prototyping data output and with some query manipulation can be used for almost all list display purpose. More on this in a moment.
HTMLFooter() then closes out the HTML document by putting end </body></html> tags at the bottom.
It's important to understand at this point that Web Connection offers a number of ways to generate output. This example uses a handful of high level methods to perform all the output generation. As we'll see later on, you can generate HTML in a number of other ways as well.
The next step will be to add user input to your request so the request becomes truly dynamic.