Skip to content

Commit e322016

Browse files
authored
Helper class details
1 parent 0af8a18 commit e322016

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,24 @@ The total number of tables in the database that was identified to build our syst
100100
- It not take any help of helper class but it self contains logic to connect DataBase and perform SQL operations
101101
- It take JDBC properties and SQL query for select all users from database with the help of **ServletContext** object and **web.xml** configuration file
102102

103+
104+
## Helper class
105+
1. com.nt.util
106+
- SqlQuerySupplier.java
107+
- This class is help Login(LoginServlet.java) | Register(RegisterServlet.java) Servlet.
108+
- It takes Servlet Context object with help of init() method of Login(LoginServlet.java) servlet and,
109+
- Store that Object into Static Refrence Variable of ServletContext Type
110+
- Using this ServletContext object this class get all properties of JDBC and SQL queries from web.xml and,
111+
- This class have a getQuery(String purpose) method which returns SQL query as String to caller
112+
2. com.nt.dao
113+
- ChatAppLoginDAO.java (Data Access Object)
114+
- Basically this class is develop with feeling as Spring bean class which useful for perform persistent logic
115+
- but that need injuctions and injuction will happens with IOC container but i'm develop this application without Spring Framework so there is no IOC container
116+
- so there is no dependency injuction without IOC Container and no DataSource injucted that'sWhy there is no chance to get DataSouces object direct but,
117+
- DataSource it injucted to Servlet only. [I'm not using DataSource "pooled conection object"]
118+
- I use standard approch and work with DriverManager class | to load DataBase driver class and get connection.
119+
- But i prefer write one time that JDBC property at single place and use it multiple places
120+
- so i decided to work with web.xml (becuse properties file not working ) and set all JDBC properties into ServletContext obj Parameters.
121+
- Servlet context objec is only accessble through servlet only that'swhy i use init() method of LoginServlet.java to give ServletContext obj indirectly to SqlQuerySupplier class. and,
122+
- finally ChatAppLoginDAO class get JDBC propertes using ServletContext object Or we can supply properties manually and,
123+
- SqlQuerySupplier class give query to perform Operations to ChatAppLoginDAO class

0 commit comments

Comments
 (0)