Solved

Filter Setup

Posted on 2002-05-30
10
325 Views
Last Modified: 2010-04-01
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
Comment
Question by:menreeq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 7044658
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
 

Author Comment

by:menreeq
ID: 7046600
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
 
LVL 4

Accepted Solution

by:
pellep earned 100 total points
ID: 7053658
try
*/*.jsp
or
*.jsp
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Expert Comment

by:cheekycj
ID: 7053836
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
 

Author Comment

by:menreeq
ID: 7056112
I have tried *.jsp.

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

0
 
LVL 4

Expert Comment

by:pellep
ID: 7056181
<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
 
LVL 19

Expert Comment

by:cheekycj
ID: 7075683
any updates?
0
 

Author Comment

by:menreeq
ID: 7076313
Ya, my computer got a virus, trying to resrore everthing.  Will try your suggestion just as soon as i have everything back online.
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7076320
ok.  sorry to hear about the virus.. take your time and let us know.

CJ
0
 

Author Comment

by:menreeq
ID: 7080061
Once again sorry for the delay. I tried *.jsp with out the / and it worked.  Thanks for the help!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Display current date,month,and year to JTextField 3 67
spring AOP 6 94
thymeleaf natural templating vs JSP 2 204
jsp insert to database example 2 91
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question