ExperSHOP Servlets


Home Contents

Please email any bug reports, comments or suggestions to ExperLog's Online Support


ExperSHOP servlets

Their role is mainly to expand DynHtml pages to generate dynamic HTML content.

Everything that concerns the session handling (who is connected) and the shopping cart management is transparent to the user.

ExperSHOP Lite comes with servlet classes:

  • com.expershop.lite.ExperSHOP, the ExperSHOP Lite servlet: tell it which DynHtml page to expand, and what action to perform.
    The ExperSHOP Lite servlet is aware of the customer's shopping cart content (through a Data Set called "ShoppingCart", chat can be used in the templates to iterate on the shopping cart and display its content, the total price, etc...)
  • com.expershop.lite.ESAdminServlet, the ExperSHOP Administration servlet: basically, it has the same functions as the ExperSHOP servlet, with some additions: a password-based access control, and a mechanism to handle orders placed by shop customers.
  • com.expershop.lite.ESUploaderServlet is the uploader servlet to upload 1 or more files to the server.

Expected HTTP parameters

The ExperSHOP servlets expect the following HTTP parameters:
  • Page: The DynHtml page to expand, relative to the ESRootDir/ESTemplates/Shop directory for the ExperShop servlet, and to ESRootDir/ESTemplates/Admin for the administration servlet. (MANDATORY)
  • Action: The action to perform before expanding the DynHtml page (OPTIONAL)
    Example: the predefined ESAddToCart action can be used to add an item in the shopping cart before displaying its content.
    See the ExperSHOP Actions tutorial for more details.
  • ActionFailed: The DynHtml page to expand is an action fails (OPTIONAL)
    This parameter makes sense only if the Action parameter has a value.
  • Cache: If set to "N" or "n", the next page will not be cached by the web browser; default is cache on.
  • ContentType: The MIME Content Type alias for the next page (OPTIONAL, default is text/html). ContentType aliases and their corresponding MIME values are defined in the application's configuration file (see the "contenttype.list" and "contenttype.[alias].value" properties in the configuration documentation.
  • The ExperSHOP "cookie" (session ID) information: necessary for ExperSHOP to keep track of who is connected.
  • Any other parameter that can be necessary for ExperSHOP to expand the next DynHtml page (example, a Product Reference to invoke a dynamic page that details products).
The first time the servlet is invoked, a shop name can be specified, using an HTTP parameter called "S_": this is for multiple shop support.

Example:

  <a href=com.expershop.lite.ExperSHOP?S_=SurfShop>
  Bill's Surf Shop</a><br>
  <a href=com.expershop.lite.ExperSHOP?S_=Supermarket>
  Online SuperMarket</a><br>
  
Example of a link to an ExperSHOP page, in a DynHtml page:
   <a href=com.expershop.lite.ExperSHOP?$COOKIE$&Page=ESListDep.tmpl>
   Departments</a>
  
$COOKIE$ is expanded into all the necessary information for ExperSHOP.
Page tells ExperSHOP which DynHtml page to expand when the link is clicked.

See the DynHtml tutorial for more details.

Shopping Cart, and Predefined data sets

In DynHtml template pages, you can loop on data sets (like query results) and display their content.

Some data sets are predefined, and always accessible:

  • The Shopping cart (data set name: ShoppingCart): see the using the shopping cart document.
  • The Shop configuration file (data set name: ShopConfig): any property in the shop configuration file can always be displayed from a DynHtml template by specifying $ShopConfig:[property-name]$; For example, $ShopConfig:shop.Currency$ displays the value of the shop.Currency property.
  • The current date (data set name: CurrentDate): see the working with dates document.

Parameters and data sets specific to the Administration servlet

See the shop administration documentation for details.

com.expershop.lite.ESUploaderServlet

The com.expershop.lite.ESUploaderServlet servlet allows to upload text or binairy files. You need to specify the source file which has to be uploaded, the destination directory, and the redirection url which will be used when the upload process will be finished. The obligatory parameters are the following:

  • urles - redirection url.
  • overwrite - on or off. If on, the file will be overwritten, else off.
  • uploadfile - file name to upload.
  • uploadfile[n] with n > 1 - file name to upload.
  • uploaddirectory - destination directory, this directory is a relative path. It is computed from the path described in the application configuration file (app.UploadDir):

    [value of app.UploadDir]/[value of uploaddirectory]

Example:
  <form enctype="multipart/form-data" method="POST" 
             action="com.expershop.lite.ESUploaderServlet">
     <input type="hidden" size="20" name="urles" 
              value="/servlet/com.expershop.lite.ExperSHOP?$Cookie$&Page=MyPage.tmpl"><p>
     <input type="hidden" size="20" name="overwrite" value="on">
     file to upload :        <input type="file" size="20" name="uploadfile" value=""><p>
     destination directory : <input type="text" size="20" name="uploaddirectory" 
              value="/tmp"><p>
     <input type="submit" name="UPLOADSERVLET" value="UPLOAD">
  </form>