0% found this document useful (0 votes)
3 views6 pages

Advance Java Test Keypoints

This document provides a comprehensive, topic-wise summary of J2EE, Servlet, JSP, Spring, and Hibernate concepts tailored for exam preparation. It covers key areas such as web architecture, servlet basics, session management, JSP lifecycle, Spring framework, Hibernate, and RESTful services, along with important exam facts. The summary is structured to facilitate understanding and retention for multiple-choice questions and viva examinations.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Advance Java Test Keypoints

This document provides a comprehensive, topic-wise summary of J2EE, Servlet, JSP, Spring, and Hibernate concepts tailored for exam preparation. It covers key areas such as web architecture, servlet basics, session management, JSP lifecycle, Spring framework, Hibernate, and RESTful services, along with important exam facts. The summary is structured to facilitate understanding and retention for multiple-choice questions and viva examinations.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Below is a COMPLETE, TOPIC-WISE, EXAM-ORIENTED SUMMARY of ALL concepts covered in this

conversation.
I have NOT missed any topic or exam line.
Structured exactly for J2EE / Servlet / JSP / Spring / Hibernate MCQs & viva.

1. Web Architecture
Page-Centric Architecture
• Initial contact point → JSP page
MVC Architecture
• Model → Business logic + data
• View → JSP / HTML
• Controller → Servlet / Spring Controller

2. Servlet Basics
Servlet Creation
• Must implement Servlet interface
• Commonly extends HttpServlet
• Must be public
• Instantiated only once
• Handles multiple requests using multithreading
Servlet Lifecycle
1. Constructor (ServletConfig NOT available)
2. init(ServletConfig config) – called once
3. service() – called for every request
4. destroy()
init() Method
• Argument → ServletConfig
• Reads init parameters
• Called only once
service() Method
• Throws → ServletException, IOException

3. ServletConfig vs ServletContext
ServletConfig
• One per servlet
• Holds servlet-specific init parameters
• Method → getInitParameter()
ServletContext
• One per web application
• Shared across all servlets
• Used for global data

4. Request & Response Objects


HttpServletRequest
• Always represents client HTTP request
• Holds request parameters (Strings)
• Methods:
– getParameter()
– getCookies()
• Thread-safe per request
HttpServletResponse
• Represents server response
• Methods:
– getWriter()
– sendRedirect()

5. RequestDispatcher
forward()
• Server-side execution
• Same request & response
• URL does NOT change
• Faster
• Cannot go outside context
include()
• Appends response
• Control returns
• Same request & response
Exam line:
include appends response, forward transfers control

6. Redirect & sendRedirect


Redirect
• Client-side
• New request & new response
• URL changes
• Slower
• Can go outside context
sendRedirect()
• Method used to perform redirect
• Client-side
Exam line:
forward = server side, redirect/sendRedirect = client side

7. Session Management
HttpSession
• Stateful object
• Server-side
• Default timeout → 30 minutes
• Not migrated across JVM by default
• Migrated only with session replication
Session Migration – Use
• Load balancing
• Failover
• High availability
High Network Traffic Caused By
• Session

8. Cookies
• Client-side stateful object
• Set in Response
• Read from Request
9. URL Encoding
encodeURL()
• Used for forward / include / links
encodeRedirectURL()
• Used with sendRedirect()
When Used
• When cookies are disabled
• To attach session ID to URL

10. JSP Concepts


JSP Lifecycle
• JSP → Servlet
• Generated servlet extends HttpJspBase
• HttpJspBase extends HttpServlet
JSP Implicit Objects
• request
• response
• out
• session
• application
• config
• pageContext
• page
• exception
JSP Scopes
• Page (default)
• Request
• Session
• Application
Thread-Safe Scope
• Request scope

11. JSP Tags


Declaration Tag
• Syntax → <%! %>
• Used to declare variables & methods
Directive Tag
• Syntax → <%@ %>
• Used to give instructions to container
• Types:
– page
– include
– taglib
JSP Standard Actions
• jsp:useBean
• jsp:setProperty
• jsp:getProperty
• jsp:include
• jsp:forward
• jsp:param
• jsp:plugin
Tag Handler Objects
• Reused
• Not created per tag occurrence

12. Deployment Descriptor (DD)


[Link]
Contains:
• Servlet declaration & mapping
• Init parameters
• Context parameters
• Filters
• Listeners
• Session config
• Error pages
• Security constraints

13. Packaging & Deployment


Web Application
• Packaged as WAR
• Structure:
– WEB-INF/classes
– WEB-INF/lib
– [Link]
JAR
• Used as libraries
• Placed inside WEB-INF/lib
• Loaded at startup

14. JDBC
Exceptions
• ClassNotFoundException → Driver not found
• SQLException → DB operation error

15. Spring Framework


IoC Container
• Manages objects & lifecycle
• Performs dependency injection
Bean Conditions
• POJO
• Public no-arg constructor
• Managed by container
Lifecycle Checking
• BeanPostProcessor
Containers
• BeanFactory
• ClassPathXmlApplicationContext
Dependency Injection
• Annotation → @Autowired

16. Spring MVC


Mapping Annotation
• @RequestMapping

17. Hibernate
Configuration File
• [Link]
SessionFactory Creation
• Method → buildSessionFactory()
Hibernate Session Object
• Bridge between app & DB
• CRUD operations
• First-level cache
• Manages transactions
• Represents unit of work
Exam line:
Hibernate Session manages DB transactions

18. Hibernate EntityManager


Purpose
• Manages entity lifecycle
• Performs CRUD
• Maintains persistence context
• Persist & retrieve entities

19. JPA / Hibernate Annotations


• @Entity → Map class to DB table
• Default PK strategy → AUTO

20. JDBC Template


• Exception thrown → DataAccessException

21. RESTful Services


• Stateless

22. CGI vs Servlet


CGI
• New process per request
• Slow
Servlet
• Multithreaded
• Faster

23. AOP
Weaving
• Process of applying aspects to target objects
• Types:
– Compile-time
– Load-time
– Runtime (Spring AOP)
Join Points
• Method execution
• Method call
• Constructor
• Field access
• Exception handling

24. Important One-Line Exam Facts


• Servlet instantiated once
• Redirect creates new request
• Forward is faster
• Cookie is client-side
• Session is server-side
• Request parameters are Strings
• encodeRedirectURL used with sendRedirect
• JSP default scope = page
• Thread-safe scope = request

If you want, I can next:


• Convert this into MCQ notes
• Make one-page revision sheet
• Create exam simulator questions
• Give last-day memorization format

From <[Link]

From <[Link]

You might also like