>>> Mark Galbreath <[EMAIL PROTECTED]> 19-Apr-01 7:20:56 PM >>>

>Okay, now I'm a little fuzzy (fuzzy logic?) on your filter thing.
>Do you mean filters in what I consider the standard sense of
>piping bytes through various input/output streams and encoders,
>or are you talking about something else?  If not too much
>trouble, would you give a concrete (i.e., code) example?

Filters are explained in detail in Servlet API 2.3 PFD. You can get
it from the Sun Java-Servlet website.

Here's a skeleton example:

class MyFilt
extends Filter
{

   public void doFilter(ServletRequest req,
                                 ServletResponse resp,
                                 FilterChain c)
   throws...
   {
      HttpSession session=request.getSession(false);
      if(session!=null)
      {
         Connection con=(Connection)session.getAttribute("dbcon");
         Statement st=con.createStatement("select * from
thingies;");
         ResultSet rs=st.executeQuery();
         request.setAttribute("results",rs);
      }
      c.doFilter(request,response);
   }
}

The JSP recieving the request can then print out the results of the
query. Of course, a lot more could be done. You could override the
request or the response objects to provide new methods.

This is better than MVC because it's using pure code to decorate the
request/response. Also the logic of dispatch plumbing has been
abstracted so that it's more managable.


Nic

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to