Java Servlets Flashcards

1
Q

What is the servlet lifecycle?

A
There is a servlet container around the web applications
1- Load Servlet Class
2- Create Instance of Servlet
3- Call the Servlet init() method
4- Call the servlet service() method
5- Call the servlet destroy method()

The steps are taken implicitly by the container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a helpful method to get the hostname of the web site?

A

Request.getContextpath() will return the web site path and then add in the address to the servlet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are Java beans?

A

Java class that stores data. Has a bunch of methods to use. Need to have values initialized.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Who creates the cookie?

A

The browser creates the cookie and is stored and interacts with the server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly