TextCounter servlet 1.6


It is a Java servlet implements simple visitors counter. You can add this counter via HTML iframe tag to your pages.

How to use it:

a) copy counterPackage.jar into your WEB-INF/lib directory.

b) define TextCounter servlet in your web.xml file.
 


    <servlet>
     <servlet-name>TextCounter</servlet-name>
     <servlet-class>com.jsos.count.TextCounter</servlet-class>
    </servlet>

c) describe a mapping for servlet in web.xml file:
 


    <servlet-mapping>
     <servlet-name>TextCounter</servlet-name>
     <url-pattern>/servlet/TextCounter</url-pattern>
    </servlet-mapping>

Now you can write on your pages some like that:
 


<iframe frameborder="0" width="20" height="20" src="http://your_host/servlet/TextCounter?path_to_data_file"/>;

As a parameter for this servlet you have to provide a path to some file on your server. You can use of course different files for different pages etc. Alternatively, you can provide a path to data file as an initial parameter for this servlet. Parameter's name is data. An optional initial parameter style lets you describe a CSS style for the counter:
 


    <servlet>
     <servlet-name>TextCounter</servlet-name>
     <servlet-class>com.jsos.count.TextCounter</servlet-class>
     <init-param>
      <param-name>data</param-name>
      <param-value>path_to_your_data_file</param-value>
     </init-param>
    </servlet>

For JSP you can simply use File taglib and read data from counter file.
 

    For downloading:   counterPackage.jar
 

 ©  Coldbeans    Comments?

See also JSOS - the largest collection of servlets and filters.

Also in Coldtags: