Web Application Eclipse Javaee

Asked

Viewed 29 times

0

I am developing a eclipse web app using Servlets, JSP and JDBC to connect to the Mysql database. Although my code does not present errors in the compilation, when I try to run the project the following error appears: http://localhost:8080/Coursemanagement/

  • 1

    Buddy, delete that image, and log Tomcat

1 answer

1


Learn this, everything that gets inside the WEB-INF directory is not accessible by the browser, this includes the Javaserver Pages that you put there. I don’t remember if it can be fooled, but at first it is so by design.

Not that you necessarily need to keep out of it. It’s been a while since I’ve programmed this, but I think for the purposes of Servlets that meet HTTP requests to access from within the web application and return these Jsps they are accessible, but by the browser directly no.

So as far as I can help, I suggest you do a little more research and change your mind about what you’re doing.

Because of this it is easy to remember, Jsps should only be views that receive chewed data and render, ideally without any knowledge of business logic, let alone business model layer code or database access.

The idea is that the HTTP calls in the browser are made to Urls mapped in Annotations placed before each Servlets method, each of these methods meets a specific HTTP method request (GET, POST, etc.), this Servlet method execute the business rule (for the sake of design it may be better that this is not done directly but perhaps by calling a service, which is an object belonging to the application layer that in turn calls the business model objects in the business layer, remembering that these layers are only logical, can only exist conceptually and establish a relationship of dependence or nondependence on each other).

Then these business model objects call data access objects, and then things start to go the other way and go up the hierarchy of layers, the data goes to the business model, which returns control to the service and this now passes the control to a JSP, that is fed with the data and renders the HTML that will be displayed by the user interface layer.

At least that’s how it was in the golden days of server-side Rendering, that has been supplanted by AJAX and I don’t know what else is used today, but the principle of layer isolation and jumping from one to the other remains, as well as layered architecture (Layered Architecture), which is what I basically described here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.