Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Blank page returned when filters are used with struts

 
Janin Bonn
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While Struts 1.X does not support servlet filters I found nothing on the web which said that struts and filters would not work. With Tomcat 5.1.15 and Struts 1.2.8 my webapp doesn't work when I configure a filter in web.xml. After the doFilter-method has finished nothing else happens and IE displays a blank page. The address line is correct and contains all parameters (Http-GET).

Is there something wrong with my configuration? Do I have to code a redirect within doFilter? Even putting loglevel to finest does not give any clues. All logfiles end at the point where the filter is used.

web.xml is like this:


It does not work with this mapping, neither:


struts-config.xml goes like this:


I would expect that after doFilter is done the ActionServlet is in control creating an instance of SomeForm and invoking SomeAction.execute. This does not happen. It works fine if the filter code is removed from web.xml.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be possible to use a filter in a Struts application. Could you show us your doFilter() method?
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used filters with Struts with JBoss/Tomcat and with Weblogic, so I know it is definitely possible. Lacking other information, at a guess I'd suspect something happening in the filter. Try creating a "do nothing" filter that just lets the request and response traffic flow through without taking any action, and just spit out a log message so you can see it taking place. In other words, the worlds silliest "hello world" filter. If that doesn't work, something strange must be going on.
 
Janin Bonn
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
UR right. I did not focus on the filter class, cos I used it in other webapps and it worked. But for some reason the chain.doFilter statement was missing.

Thanks anyway.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic