Jeśli JSP jest starszy niż jego generowanego serwletu, kontener JSP zakłada, że JSP nie uległa zmianie i że wygenerowany serwlet nadal odpowiada za zawartość JSP.
If the JSP is older than its generated servlet, the JSP container assumes that the JSP hasn't changed and that the generated servlet still matches the JSP's contents.
Na przykład, jeśli masz pełną nazwę klasy com.myorg.MyServlet, to klasa serwlet musi znajdować się w następującym katalogu
For example, If you have a fully qualified class name of com.myorg.MyServlet, then this servlet class must be located in the following directory
Ten przykład pokazuje, jak serwlet wykonuje Automatyczne odświeżanie strony przy użyciu setIntHeader () metodę, aby ustawić Odśwież nagłówek.
This example shows how a servlet performs auto page refresh using setIntHeader() method to set Refresh header.
GET/ HTTP/1.0 Serwlet będzie miał dostęp do cookie poprzez metodę żądanie request.getCookies (), która zwraca tablicę Cookie przedmiotów.
A servlet will then have access to the cookie through the request method request.getCookies() which returns an array of Cookie objects.
Cykl życia JSP można zdefiniować jako cały proces od jego utworzenia aż do zniszczenia, który jest podobny do cyklu serwlet o dodatkowy etap, który jest wymagany w celu opracowania JSP do serwletów.
A JSP life cycle can be defined as the entire process from its creation till the destruction which is similar to a servlet life cycle with an additional step which is required to compile a JSP into servlet.
Podczas wykonywania, serwlet tworzy wyjście w formacie HTML, który silnik serwletów przechodzi do serwera wewnątrz odpowiedzi HTTP.
During execution, the servlet produces an output in HTML format, which the servlet engine passes to the web server inside an HTTP response.
JavaServer Pages są zbudowane na górze API serwlet, tak jak serwlety, JSP ma również dostęp do wszystkich zaawansowanych funkcji API Enterprise Java, w tym JDBC, JNDI, EJB, JAXP etc.
JavaServer Pages are built on top of the Java Servlets API, so like Servlets, JSP also has access to all the powerful Enterprise Java APIs, including JDBC, JNDI, EJB, JAXP etc.
Serwlet jest inicjowany przez wywołanie init () sposobu.
The servlet is initialized by calling the init () method.
Po zakończeniu pracy serwletu wywoływana jest metoda destroy() zwalniająca zasoby alokowane przez uruchomiony serwlet.