Code:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletResponse res = (HttpServletResponse)response;
HttpServletRequest req = (HttpServletRequest)request;
HttpSession ses = (HttpSession) req.getSession();
[red]Object user = ses.getAttribute("user");[/red]
if (user==null)
try {
res.sendRedirect("/login.jsp");
} catch(IOException e) {
e.printStackTrace();
}
}
cannot find symbol:[tt]
symbol : method getAttribute(java.lang.String)
location: interface javax.servlet.http.HttpSession
Object user = ses.getAttribute("user");[/tt]
It's obviously importing the HttpSession object, otherwise it would throw more errors. It's compiling with Tomcat's servlet-api.jar in the classpath.
<marc>
New to Tek-Tips? Get better answers - faq581-3339