aspose file tools*
The moose likes Struts and the fly likes Struts Filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Filter" Watch "Struts Filter" New topic
Author

Struts Filter

vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
Hi ,

I am developing struts application.I am having a task to develop a filter that checks the session for every jsp page.Below is the code which i wrote...


After passing through the filter how the request will go to the action servlet..How to configure...

Please anyone guide me..

Thanks & Regards,
Vipul Kumar.


Thanks
Vipul Kumar
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
In your doFilter method you have a parameter of type FilterChain. Do you know what it does? If not I suggest you to please go through that. You will get your answer.
vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
Thanks Bhanu,

Filter is working fine.I am having one more doubt..Please check my web.xml file.




Is the <url-pattern> correct?only .do reqeusts are intercepted by the filter and not the .jsp .

Please check and guide me..

Thanking You,
Vipul Kumar.
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
From servlet 3.0 spec.
If a filter mapping contains both <servlet-name> and <url-pattern>, the container
must expand the filter mapping into multiple filter mappings (one for each <servletname>
and <url-pattern>), preserving the order of the <servlet-name> and <urlpattern>
elements. For example, the following filter mapping:
is equivalent to


So, ideally you should be declaring two <url-pattern> tags. If you are not using servlets 3.0 please check the relevant servlet specs.
Hope this helps.
 
Consider Paul's rocket mass heater.
 
subject: Struts Filter