CPPSERV


Home Projects Jobs Clientele Contact

cppserv


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CPPSERV 0.2.6 has been released



CPPSERV is an application server written
in C++ and provides API very similar to
that Java Servlets.
CPPSERV also has CSP (C++ Server Pages)
compiler, which allows to mix C++ and markup
code in a manner similar to JSP. The CSP
compiler supports compile-time taglibs
(extensions to CSP syntax, which convert
custom tags to application-defined code).

CPPSERV CSP comes with its standard tag library,
which includes tags for iterating over STL collections,
and tags for defining macros. Flow control tags
are not yet implemented, but they might be in
future.

Release 0.2.6 extended the CSP compiler and its
taglib support in a few important ways, designed
to make it possible to make final compiled code
as compact as possible.

Main changes in this release:
- Support for redirecting custom tag content
  to a different stream.
- Support for generating separate files for
  declaration and definition for CSP servlet.
- Ability to specify class name for CSP
- Ability to create "abstract" CSP (that
  is one, without main servlet handler function)

With previous releases, if one wanted to have
some common pieces of look and feel, one would
create an include file, and use <%@include%> directive.
This resulted in the code being duplicated across
all the servlets. In some cases, string literals
(all the HTML in this case) would be duplicated
as well.

With 0.2.6 one can do following instead:
- Create an abstract base page
<%@page class="MyAppCspBase" abstract="true"%>
- Define all common interface elements
<csp:define name="menuitem" params="const std::string& title, const
std::string& dest">
<div class="menuitem"><a href="<%=dest%>"><%=title%></a></div>
</csp:define>
<csp:define name="pageHead" params="const std::string& title">
<html><head><title><%=title%></title></head><body>
</csp:define>
- Inherit your actual pages from the base page class
<%@page extends="MyAppCspBase" import="cspbase.h"%>
- Import the defines into current page
<csp:usedef name="pageHeader"/>
- Call them
<%pageHeader("Home page");%>

Net result: the code to generate pageHeader
only exists once.

-- 
Ilya A. Volynets-Evenbakh
http://www.total-knowledge.com


Authoright © Total Knowledge: 2001-2008