Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

Filter Setup

I am having trouble setup a filter to function on only my jsp files. Below is what i have in my web.xml file. But it does not function.  How do i specify this correctly?

<filter>
<filter-name>SemestreSelectedFilter</filter-name>
<filter-class>ies.SemestreSelectedFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SemestreSelectedFilter</filter-name>
<url-pattern>/*.jsp</url-pattern>
</filter-mapping>

Thanks
0
menreeq
Asked:
menreeq
  • 4
  • 4
  • 2
1 Solution
 
cheekycjCommented:
what is not working?

How do you know your filter is not being invoked?

Make sure you are using a servlet engine (Tomcat 4.0 and greater or a servlet engine that supports Servlet 2.3 spec) that supports Filters.

CJ
0
 
menreeqAuthor Commented:
When i use "/*.jsp" it does not invoke the filter for any files.  I know it works because when i change it to "/*" it functions on all the files, including the images in the sub-directory.  

Perhaps it´s due to me calling url-pattern and not specifying a valid pattern?  Or is "/*.jsp" a valid url-pattern?
0
 
pellepCommented:
try
*/*.jsp
or
*.jsp
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
cheekycjCommented:
have you tried just this:

<filter-mapping url-pattern="*.jsp" filter-name="ies.SemestreSelectedFilter" />

or

<filter-mapping url-pattern="/*.jsp" filter-name="ies.SemestreSelectedFilter" />
0
 
menreeqAuthor Commented:
I have tried *.jsp.

I will try now /*.jsp and */*.jsp

0
 
pellepCommented:
<url-pattern>*.jsp</url-pattern>
has always worked for me. it could be that there is already a 'default' filter in place defined earlier in the web.xml file.
0
 
cheekycjCommented:
any updates?
0
 
menreeqAuthor Commented:
Ya, my computer got a virus, trying to resrore everthing.  Will try your suggestion just as soon as i have everything back online.
0
 
cheekycjCommented:
ok.  sorry to hear about the virus.. take your time and let us know.

CJ
0
 
menreeqAuthor Commented:
Once again sorry for the delay. I tried *.jsp with out the / and it worked.  Thanks for the help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now