Here is my FilterRequest.java file code
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {
try{
HttpSession session = ((HttpServletRequest) req).getSession();
User u = (User) session.getAttribute("loggedUser");
System.out.println(u);
if (u!= null)
{
chain.doFilter(req, resp);
return;
}
else{
String message = "Please Login!";
req.setAttribute("loginMsg", message);
RequestDispatcher rd = getServletContext().getRequestDispatcher("/login2.jsp");
rd.forward(req, resp);
}
}catch(Exception e){
e.printStackTrace();
}
}
This is my web.xml Mapping code..
<filter>
<filter-name>FilterRequest</filter-name>
<filter-class>com.mobitel.bankdemo.web</filter-class>
</filter>
<filter-mapping>
<filter-name>FilterRequest</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
when I run the project from the beginning it says "
The requested resource is not available.
"
Where i went wrong? please guide me