devxlogo

November 16, 2002

List of Most Commonly Used CGI Equivalents of Servlets

AUTH_TYPE request.getAuthType()CONTENT_LENGTH request.getContentLength()CONTENT_TYPE request.getContentType()DOCUMENT_ROOT getServletContext().getRealPath()PATH_INFO request.getPathInfo()PATH_TRANSLATED request.getPathTranslated()QUERY_STRING request.getQueryString()REMOTE_ADDR request.getRemoteAddr()REMOTE_HOST request.getRemoteHost()REMOTE_USER request.getRemoteUser()REQUEST_METHOD request.getMethod()SCRIPT_NAME request.getServletPath()SERVER_NAME request.getServerName()SERVER_PORT request.getServerPort()SERVER_PROTOCOL request.getProtocol()SERVER_SOFTWARE getServletContext().getServerInfo() HTTP_XXX_YYY Variables of the form HTTP_HEADER_NAME can be accessed using the request.getHeader(Header-Name) Example:

A Quick Way to Convert RecordSet to an HTML Table

Public Function GetHtmlString(rs)Dim StrHtmlDim FldLimiter,RowLimiterFldLimiter=””RowLimiter=””If Not rs.EOF ThenStrHtml=”” ‘Table Tag’Prefix for 1 col valueStrHtml=StrHtml & “”StrHtml=StrHtml & rs.GetString(2,-1,FldLimiter,RowLimiter)’Trim of the Last StrHtml=Left(StrHtml,Len(StrHtml)-Len(“”))’Close TableStrHtml=StrHtml & “”End IfEnd Function Usage: Response.Write(GetHtmlString(rs))

Determine the Identity Value of Inserted Row(s)

IN tblTicker table we have following fields: [CompanyID] INT IDENTITY (1,1) [TickerSymbol] [char] (10) NULL [ClassOfShare] [char] (10) NULL We inserted some rows and deleted some from table tblTicker.Now At

Delete the Contents of a List

This technique allows you to delete the contents of a List at the same time you are storing pointers a list. This same approach can be used for maps or

Pointer to a Constant vs. Constant Pointer

The const keyword in C++ provides a type-safe way to replace some of those #define preprocessor statements that you’re used to writing from C.Whenever you have a value that you

Listening to All AWT Events

For some programs, it is helpful to create a listener to keep track of all the events being dispatched by the UI. This can be very useful in debugging programs.