java – JSP Login Authentication Script failing (MySQL-backend) web.xml servlet mapping? – Education Career Blog

I am just starting out with JSP in NetBeans 6.9.1 and im trying to make a basic login script for user authentication (sessions will be added later; These are made automatically for every JSP page right?)

The problem I am having is the following.
I followed the tutorial at:

** I made the necessary changes (Database related) **

When running the project I get the login screen presented, as it should.
Although when filling out the details for database authentication, I keep on running into a 404 error: “descriptionThe requested resource () is not available.”

I think the problem might be lying in my web.xml for not mapping the servlets right.
(This was not mentioned in the tutorial though.)

See below for my web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" <CANT POST namespace hyperlinks. New user...>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-name>Faces Servlet</servlet-name>

I hope you guys have time to look at it!

(First time posting here so if there is anything im doing wrong, please let me know.




First of all, is the worst source ever to learn Java EE (JSP/Servlet/JSF/etc). Its tutorials are cluttered of bad practices and do in no way explain/use the basic concepts properly. It’s maintained by copypaste-addicted amateurs with advertisement incomes as #1 priority. For me, that side is ridiculous, but for new-to-Java EE users it may be very misleading because they don’t know what’s good or bad.

Your functional requirement is sound, but the posted web.xml makes no sense. Firstly, you seem to have declared an ordinary Javabean class (which does not extends HttpServlet) as a Servlet. Secondly, the class is not been placed inside a package, although this may not be the root cause of your problem, packageless classes are invisible to other classes inside a package and instantiating them will only work in very specific environments.

Further I also see the FacesServlet being declared in web.xml. This is part of JSF, a component based MVC framework which is designed on top of Servlet API and can use JSP files as views.

What do you want? Develop a login page using JSF or using “plain” JSP/Servlet?

Anyway, I strongly recommend to blacklist as a learning source and continue with proper tutorials and books. E.g. the tutorials provided by Oracle itself and the JSF2 – The Complete Refernce book of JSF spec lead himself. Further details about tutorials and books depends on whether you’d like to use JSF or not.

See also:

Leave a Comment