Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filters....not working for me :(

 
Pavan Chowdary
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
web.xml
<filter>
<filter-name>Secure</filter-name>
<filter-class>filter.FilterServlet</filter-class>
</filter>
<filter-mapping>
<filter-name>Secure</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
public class FilterServlet implements Filter
{
public void doFilter(ServletRequest req , ServletResponse resp , FilterChain fchain) throws IOException , ServletException
{
if (!req.isSecure())
{
System.out.println("inside filter....");
fchain.doFilter(req , resp);
}
else
{
System.out.println("sfasfdsdfaf");
}
}
public void destroy()
{
}
public void init(FilterConfig config) throws ServletException
{
}
}
when i access a.jsp ...above filter class is not printing appropriate system.out.

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<url-pattern>*.jsp</url-pattern>
Try this:
<url-pattern>/*.jsp</url-pattern>
URL pattern should start with a /
- satya
ps:
Not sure if you are still around
:roll:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic