• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Filter

 
Ranch Hand
Posts: 253
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 John
Ranch Hand
Posts: 253
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic