U5 Jsp & Servlet Flashcards

(24 cards)

1
Q

What is a Servlet?

A

A Java class that handles HTTP requests and generates dynamic responses.

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

Describe Web Application Architecture in Java.

A

Client sends request → Web Server → Servlet → Database → Response.

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

Name some common HTTP methods.

A

GET, POST, PUT, DELETE.

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

What is the difference between Web Server and Web Container?

A

Web Server handles HTTP; Web Container runs Servlets and JSPs.

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

Name core Servlet classes/interfaces.

A

Servlet, GenericServlet, HttpServlet.

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

Explain Servlet life cycle stages.

A

Loading, init(), service(), destroy().

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

What is ServletConfig?

A

Object that stores servlet configuration parameters.

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

What is ServletContext?

A

Shared object across servlets in the application.

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

What is sendRedirect()?

A

Redirects client to a new resource URL.

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

What is forward() in RequestDispatcher?

A

Forwards request to another resource within server.

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

What are cookies?

A

Small text files stored on client side to track data.

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

What is URL Rewriting?

A

Appending session info to URL.

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

What is a JSP?

A

JavaServer Page that allows embedding Java in HTML.

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

Explain JSP life cycle.

A

Translation, Compilation, Initialization, Execution, Destruction.

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

What are JSP declarations?

A

Used to declare variables/methods. Syntax: <%! %>

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

What are JSP scriptlets?

A

Java code within JSP. Syntax: <% %>

17
Q

What are JSP expressions?

A

Outputs result. Syntax: <%= %>

18
Q

List any 5 implicit JSP objects.

A

request, response, session, out, application.

19
Q

What is the page directive?

A

Defines page settings like import, errorPage.

20
Q

What is include directive?

A

Includes another file’s content. Syntax: <%@ include file=’…’ %>

21
Q

What is taglib directive?

A

Declares tag libraries in JSP.

22
Q

What is <jsp:useBean>?</jsp:useBean>

A

Instantiates a JavaBean in JSP.

23
Q

What is <jsp:setProperty>?</jsp:setProperty>

A

Sets a property of the bean.

24
Q

What is <jsp:getProperty>?</jsp:getProperty>

A

Retrieves and displays bean property value.