Wednesday, 23 September 2015
Tuesday, 16 June 2015
Struts 1 and 2 Architectures
Struts Architecture
Step 1: User Sends the request to Action Servlet.Step 2: Struts-config.xml contains the Actions, Forms, ActionForwards and Mappings.
Step 3: Bundle all the request into a JavaBean extends the ActionForm.
Step 4: Decides which action class invokes to process the request.
Step 5: Vallidate the data.
Step 6: Action Class process the request with the help of ModelComponent.
Step 7: The Model interacts with DB and process the request.
Step 8: Completing the request process by Action class and returns the ActionForward to the controller.
Step 9: Based on ActionForward the controller will invoke the Appropriate View.
Step 10: Response with render back to View Component.
Struts 2 Architecture
Step 1: User sends the request to the container.
Step 2: Container call the web.xml file and get the controller name.
Step 3: Controller calls the ActionMapper and gets the action.
Step 4: Based on action it will call the Action Proxy
Step 5: Action proxy will call the Configuration manager which in struts.xml file to get the info of action.
Step 6: Action Proxy process the request to Action Invocation.
Step 7: Action Invocations invokes all Interceptors and call the Action.
Step 8: Based on Action result (Response) will generate through the Action Invocation.
Step 9: Through the HttpServletResponse will sent the result to the End user.
Wednesday, 7 January 2015
JDBC Connection Steps
Jdbc Connection:
Step 1: Loading the driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Step 2: Preparing the Connection String
String cs = "jdbc:odbc:dsnName";
Step 3: Request for the connection
Connection con = DriverManager.getConnection(cs,"username","password");
Step 4: Perform the dml operations
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from Employee");
Step 4: Storing the Results in Result Set
while(rs.next())
{ rs.getInt(1); rs.getString(2);rs.getDouble(3);}
Step 5: Close the all open connections.
rs.close(); st.close(); con.close();
PreparedStatement in JDBC:
Step 1 & 2 & 3 are same
Step 4: PreparedStatement is used to store the data dynamically. We can execute the SQL statements multiple times using paramaterized statements.
String insertps = con.prepareStatement("insert into Employee values(?,?,?)");
String updateps = con.prepareStatement("update Employee set name = ?, address = ?, salary =?");
String deleteps = con.prepareStatement("delete Employee where salary =?");
String selectps = con.prepareStatement("select * from Employee where EmpNo = ?");
Step 5: For all above statements set the parameters using setXXX and send
insertps.setString(1,EmpNo);
insertps.setString(2,Address);
insertps.setDouble(3,Salary);
Step 6: Like above we can delete and update all the PreparedStaments.
Step 7: Finally Close the connections.
Step 1: Loading the driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Step 2: Preparing the Connection String
String cs = "jdbc:odbc:dsnName";
Step 3: Request for the connection
Connection con = DriverManager.getConnection(cs,"username","password");
Step 4: Perform the dml operations
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from Employee");
Step 4: Storing the Results in Result Set
while(rs.next())
{ rs.getInt(1); rs.getString(2);rs.getDouble(3);}
Step 5: Close the all open connections.
rs.close(); st.close(); con.close();
PreparedStatement in JDBC:
Step 1 & 2 & 3 are same
Step 4: PreparedStatement is used to store the data dynamically. We can execute the SQL statements multiple times using paramaterized statements.
String insertps = con.prepareStatement("insert into Employee values(?,?,?)");
String updateps = con.prepareStatement("update Employee set name = ?, address = ?, salary =?");
String deleteps = con.prepareStatement("delete Employee where salary =?");
String selectps = con.prepareStatement("select * from Employee where EmpNo = ?");
Step 5: For all above statements set the parameters using setXXX and send
insertps.setString(1,EmpNo);
insertps.setString(2,Address);
insertps.setDouble(3,Salary);
Step 6: Like above we can delete and update all the PreparedStaments.
Step 7: Finally Close the connections.
Subscribe to:
Posts (Atom)
SpringBoot
SpringBoot SpringBoot Application : Pros & Cons : SpringBoot Application creation using spring.io : SpringBoot Application Annotation...
-
Boolean Expression Complexity allowed max : 3 Ex: In below method we need to reduce the complexity to 3: /*private boolean check(Stri...
-
Lombok Plugin implementation (To Avoid Setters and Getters in Pojo's and Entitties) Step 1: Add lombok latest dependency in pom.xm...
-
Spring Boot is a framework which have Auto Configuration, Auto Dependency Resolution and Embedded HTTP Server like Tomcat and Jetty. S...