KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I was trying to implement a login filter in my web app with jsf 2, following this guide: https://stackoverflow.com/tags/servlet-filters/info after I compiled my filter and added the .class in "web-inf/classes" (as the guide says) the filter worked, but i put the wrong url to redirect to the login page so i deleted the filter.class from the folder (web-inf/classes) and tried to compile the project again , but it failed, and since then im getting "package javax.servlet does not exist" it is weird because before it was working and i have javax.servlet in my pom.xml.. i tried cleaning the project, but nothing. this is my filter class: package Bean; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Created with IntelliJ IDEA. * User: rodrigo * Date: 28-04-13 * Time: 06:54 AM * To change this template use File | Settings | File Templates. */ @WebFilter("/Contenido/*") public class filtro implements Filter { @Override public void init(FilterConfig config) throws ServletException { // If you have any <init-param> in web.xml, then you could get them // here by config.getInitParameter("name") and assign it as field. } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException { HttpServletRequest req = (HttpServletRequest) request; LoginBean user = (LoginBean) req.getSession().getAttribute("user"); if (user != null && user.
Tags (comma-separated)
Save Edits
Cancel