File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Filter

 
vipul bondugula
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
bhanu chowdary
Ranch Hand
Posts: 256
  • 0
  • Mark post as helpful
  • send pies
  • 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 bondugula
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic