Popup filter ver. 1.4

This is a Java servlet filter (as per Servlet API 2.3). PopupFilter lets you to add JavaScript popup to all responses. For example, you may show some advertising, announces etc. Initial parameters for this filter describe your own settings for JavaScript window.

How to use it:

a) download popupflt.jar and save it in WEB-INF/lib

b) describe this filter in web.xml. There are two initial parameters:
url - describes an URL for your popup's
window - describes your settings for JavaScript's window
for example:
 


<filter>
  <filter-name>PopupFilter</filter-name>
  <filter-class>com.cj.popup.PopupFilter</filter-class>
  <init-param>
    <param-name>url</param-name>
    <param-value>http://www.acme.com/banner.cgi</param-value>
  </init-param>
  <init-param>
    <param-name>window</param-name>
    <param-value>width=530, height=300, location=no, toolbar=no, menubar=no, scrollbars=yes, resize=yes, top=30,left=30</param-value>
  </init-param>
</filter>

c) describe a mapping for this filter in web.xml
 


<filter-mapping>
  <filter-name>PopupFilter</filter-name>
  <url-pattern>*.jsp</url-pattern>
</filter-mapping>

in this case filter will be on for the each .jsp file. And for the each request filter will add the following JavaScript code to the given response:
 


<script language="JavaScript">
 window.open('http://www.acme.com/banner.cgi','PopupFilter',
'width=530,height=300,location=no, toolbar=no, menubar=no, scrollbars=yes, resize=yes, top=30, left=30');
</script>

   For downloading:
    Filter:  popupflt.jar

 ©  Coldbeans     Comments?

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

Also in JSOS: