U5 Jsp & Servlet Flashcards
(24 cards)
What is a Servlet?
A Java class that handles HTTP requests and generates dynamic responses.
Describe Web Application Architecture in Java.
Client sends request → Web Server → Servlet → Database → Response.
Name some common HTTP methods.
GET, POST, PUT, DELETE.
What is the difference between Web Server and Web Container?
Web Server handles HTTP; Web Container runs Servlets and JSPs.
Name core Servlet classes/interfaces.
Servlet, GenericServlet, HttpServlet.
Explain Servlet life cycle stages.
Loading, init(), service(), destroy().
What is ServletConfig?
Object that stores servlet configuration parameters.
What is ServletContext?
Shared object across servlets in the application.
What is sendRedirect()?
Redirects client to a new resource URL.
What is forward() in RequestDispatcher?
Forwards request to another resource within server.
What are cookies?
Small text files stored on client side to track data.
What is URL Rewriting?
Appending session info to URL.
What is a JSP?
JavaServer Page that allows embedding Java in HTML.
Explain JSP life cycle.
Translation, Compilation, Initialization, Execution, Destruction.
What are JSP declarations?
Used to declare variables/methods. Syntax: <%! %>
What are JSP scriptlets?
Java code within JSP. Syntax: <% %>
What are JSP expressions?
Outputs result. Syntax: <%= %>
List any 5 implicit JSP objects.
request, response, session, out, application.
What is the page directive?
Defines page settings like import, errorPage.
What is include directive?
Includes another file’s content. Syntax: <%@ include file=’…’ %>
What is taglib directive?
Declares tag libraries in JSP.
What is <jsp:useBean>?</jsp:useBean>
Instantiates a JavaBean in JSP.
What is <jsp:setProperty>?</jsp:setProperty>
Sets a property of the bean.
What is <jsp:getProperty>?</jsp:getProperty>
Retrieves and displays bean property value.