java - Authentication Servlet Filter -


i created java ee application tutorial: http://prideafrica.blogspot.com/2007/04/simple-authentication-servlet-filter.html

but not know libraries needed. these lines give me "cannot find symbol" errors:

user user = userfacade.findbyusername(username); usertoken tok = authentication.authenticateuser(user, username, password); servletcontext context = filterconfig.getservletcontext(); 

and question. need add these files in tutorial?

thanks. sorry bad english.

you need add servlet api library project. if use maven manage dependency, here dependency setting:

<dependency>     <groupid>javax.servlet</groupid>     <artifactid>servlet-api</artifactid>     <version>2.5</version> </dependency> 

you may need change version of servlet api depending on version want use , whether servlet container support it. since creating java ee web application, guess servlet container should support version 3.0. normally, netbeans should add library classpath when create web application project.

if using netbeans , add servlet api classpath, should able use netbeans fix should imported, right click in code editor , clikc "fix import". whatever cannot fixed need take care of yourself.

you need have better understanding of web authentication, @ least how basic authentication work.

i recommend have @ spring-security, can deal of authentication problems. however, beginner, can little difficult.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -