Laboratory work No. 2 for web programming
View the application
The content of the project
A web application on the basis of the Servet and JSP has been developed, which determines the point of point on the coordinate plane into a given area.
The application is implemented in accordance with the MVC template and consists of the following elements:
Controllerservlet , which determines the type of request, and, depending on whether the request contains information about the coordinates of the point and the radius, delegating its processing to one of the components listed below. All requests inside the application are transmitted to this sergete using the POST method, the rest of the serfs from the web pages are not directly called.
AreChecServlet , checking the point of point in the area on the coordinate plane and forming an HTML page with the results of the check. Processing all requests containing information about the coordinates of the point and the radius of the region.
The JSP page forming an HTML page with a web form. It processes all requests that do not contain information about the coordinates of the point and the radius of the region.
The designed JSP page contains:
- The form sending the data to the server.
- A set of fields for setting the coordinates of the point and radius of the region.
- JavaScript scenario, which validates the values introduced by the user into the fields of the form.
- An interactive element containing the image of the area on the coordinate plane and realizes the following functionality:
- If the radius of the region is installed, a click by the mouse cursor is faced with a JavaScript function that determines the coordinates of the point at which the user clicked and sends the received coordinates to the server to check the fact of hit.
- Otherwise, after clicking on the picture, a message is displayed about the impossibility of determining the coordinates of the point.
- After checking the fact of the point of point in the region, the image is updated taking into account the results of this check (i.e., a new point should appear on it).
- Table with the results of previous checks. The list of results is taken from the context of the application.