Chapter 2: SRF Files


Overview

SERVER RESPONSE FILES (SRFs) [1] are a new file type created by the ATL Server team for storing dynamic and static HTML content in a single file. This new solution was designed to help completely separate the development of HTML layout (static HTML) from the development of dynamic HTML content.

Separating layout/design from code is a problem that has plagued Web development teams for many years . Finally there s a solution that allows Web designers to concentrate on HTML layout and design, and that enables developers to concentrate on writing the underlying C++ code. There s no longer any need for developers to tinker with the HTML layout files (SRF files), and there s no longer any need for designers to tinker with the code.

You saw a basic SRF file in Chapter 1, but here s a quick recap:

 <html>    <head> Basic SRF </head>    {{handler BasicSrf.dll/Example}}    <body>      Hello {{World}}    </body>  </html> 

This simple demonstration application contains two tags. The first tag is the handler tag. This tag tells your ISAPI DLL which class in which application DLL will handle calls to this file. This handler class is simply a class inheriting from IRequestHandlerT (or commonly, CRequestHandlerT ). It s required that you have at least one handler tag in your SRF file (you ll learn about using more than one handler later on in this chapter). It s also required that this handler tag be the first (noncomment) ATL Server tag encountered in the SRF file.

Now let s move on to look at the World tag. This tag calls into a method in your handler class, which in turn is able to spit output into the HTML stream at the location of this tag. That is, if you were to have the World() method spit the string World! , your HTML stream (returned to the client) would look like this:

 <html>  <head> Basic SRF </head>  <body>    Hello World!  </body>  </html> 
Note  

The method itself may not be called World() , but for the purposes of this chapter, assume that the method being invoked in the handler class has the same name as the tag name in the SRF file. The subtleties of this will become clearer in Chapter 3.

Note  

Remember that ATL Server dynamic tags are server side, not client side. If you ve used ASP before, you should be familiar with this concept.

What makes the double brace syntax particularly nice is that not only does it get ignored by HTML editors (which makes Web design and layout an easier task), but it can also be used anywhere within an HTML file, making the following type of coding possible:

 <img src="{{GetImage}}" > 

[1] You can change the file type from .srf to whatever you like. You can find out more about doing this in Chapter 17.




ATL Server. High Performance C++ on. NET
Observing the User Experience: A Practitioners Guide to User Research
ISBN: B006Z372QQ
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net