authentication - HttpServletRequest#login() method not found in eclipse -


i'm trying example work: http://jugojava.blogspot.de/2011/07/jsf-form-authentication-on-servlet-3.html problem occures at:

request.login(username, password); 

eclipse says: "the method login() undefined type httpservletrequest". i'm using jdk 1.7 mojarra 2.1.0 , glassfish 3.1.

thanks help!

that method introduced since servlet 3.0. so, it's available if configure , develop project against servlet 3.0 compatible container such glassfish 3.x.

however, seem have glassfish 3.x. there other possible causes particular problem, given you're developing in eclipse:

  • glassfish isn't been associated project's target runtime. in project's properties, make sure it's been selected in targeted runtimes section. way eclipse automagically include libraries in project's buildpath.

    enter image description here

  • project isn't been configured servlet 3.0 project. in project's properties, make sure dynamic web module version set 3.0 in project facets section. way eclipse automagically build against version 3.0 instead of lower one.

    enter image description here

  • you've manually downloaded arbitrary javaee.jar and/or servlet-api.jar files of different servletcontainer version , placed in project's buildpath/classpath via /web-inf/lib getting precedence on glassfish's own libraries. utterly wrong. should not that. undo changes. unnecessary if specify server targeted runtime.

see also:


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -