1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
ADVANCE JAVA:- JAVA SE(standard Edition) JAVA EE(Enterprice Edition) JAVA ME(MOBILE EDITION) 1)Se is used to make basic application or we use them for devlopment of standard alone application (this application does not use internet to run). 2)Ee is used to make web application. framework (hibernate, example) :-servlet is a java program which can run on any server and which can accept request and response .(if we have java program and we have to make it servlet then there are three ways :- (a) we have to implement sevlet interface (b) we have to extend generic servlet class (c) we have to extend http servlet :-)all servlet directly or indirectly implements servlet interface ------ by implementing servlet interface ------- (init ,service and destroy) are called life cycle method. 1)init method is used to initalise and it is called only for one time . 2)when any request arrive from client it is recieved by the service method and it can run any no of time. (it depends on the no of request arrive). 3) destroy is called when servlet is about to finish and it is also called one time in the cycle same as init. --> web container:- program in which servlet runs. --> Application server:-it contain web container . :- when client send request it is requested by request object and it response is given by response object. ------ by generic servlet class -------- ------ by http class-------- whenever a client sends or recieve data fro server then it is called protocol. there are two type of methos post and get. when a request arrive then service method is always called and then is request arrive from post or get then it will call doget() or dogpost(). :-)in http servlet processRequest method is called when the code is common for doget() and dopost(). try (PrintWriter out = response.getWriter()) :- try with resourse . when we made a object then we have to close it but in try with resourse object is automatically closed. get method it has some limit and this data is mentoid in url too. post method there is no limit and the data is not mentoid in url . sendRedirect() when this is called the new page is open which address is mentoid in the sendRedirect and new request and response object are created always . syntax will be response.sendRedirect("example.html"); RequestDispatcher rd=request.RequestDispatcher("example.html"); rd.forword(request,response); in forword we will get. --> if we have to pass data to servlet initially then we will use servletconfig or servletcontext. servletconfig :- in this we can pass data to individually for each servlet . if we want same data to each servlet then we will use servlet context and servletcontext oject will be created once but not as servletconfig where new object will be created. :-)web app provide set of rules . :-)BY CONVENTION COMPANY DOMAIN IS REVERSED AND WHICH IS USED TO MAKE PACKAGE . :-)FORNAME IS USED TO LOAD CLASS INTO MEMEORY WIHTOUT CREATING ANDY OBJECT. :-)IF WE HAVE TO PASS DATA TAKEN FROM THE UESR THEN THE STATTMENT IS USED OR PREPAID STATMENT IS USED. 3)Me is used to make mobile addition .