Sunday, September 14, 2014

Implicit Object

* What is the implicit object ?
 
   - Implicit object is loaded by web container.Programmer don't need to create implicit object in a jsp page.A jsp container automatically create implicit object and maintain implicit object in a jsp page.

   - Implicit object is classified into four categories as,:

     + Input and output objects.
     + Scope communication and control object.
     + Servlet objects.
     + Error objects.

* The flowing is a example of servlet.


+  This index page.This page is used to enter information of user and then send to jsp page for processing.




+ This is home page .This page is used to save username of user into "userName" session and then display the session for user.

Monday, September 8, 2014

ServletContex


* ServletContex provides access to various resource and facilities,which are common to all servlet in application.Servlet Apis is used to set the information common to all servlet in application.

  - ServletContex methods are used to get and set additional information about servlet.The methods used for dealing with context Attributes are:
 
   + getAttribute();
 
   + setAttribute();

* The following is a example of servlet.This example is used to count the numbers of page view.




This page is used to establish to servletcontext with name is 'count'.After that the value of this servletcontext is displayed.

Sunday, September 7, 2014

Session


* Because http is stateless protocol.It mean that,it don't save state of user.For example,when you surf a shopping web and you don't want to enter your information for each buy.Therefore session was born to maintain that information in servlet.

   - There are five ways to manipulate with session.
   
    + Url writing.
    + Hidden form variable.
    + Persitent cookies.
    + Persiten mechanism.
    + Servlet APIs

   -  The following is a example about session.



 - This is index page.This page is used to enter information of user .After that this information is sent to LoginServlet for processing.



 
  -This is LoginServlet page.This page is used to receive information that is send by client(userName).After that ,this username is saved into session.


- This page is used to display information saved in session username.














Request Dispatcher


* Request dispatcher is used to dispatch a request from one servlet to another servlet for futher proccessing.

   - There are two importaint methods of Request dispatcher.those are:
   
     + forward();this method is used to forward one servlet to another servlet on the same server.

     + include():this method is used to include the content of another servlet,jsp and html pages.


* Example of Request dispatcher.




  - We have techsupport.html file .This file is used to take request of user and send to techsupportservlet.After,techsupportservlet process and check whether user have registered or not.
if user have registered ,then user would be forwarded to ResponseServlet.If not user would be forwarded to RegisterServlet and when user have registered , this user is also forward to responseservlet. 

* The following is code of the above example.
   


   - This is index page.This page is used to help user entering information of them and after that this inforamtion is sent to Techsupporservlet.
     


    - This is register page.This page is used to help user registering a new account.


   
 - This is techsupportServlet.This page is used to recieve the information.That is send by user in index pages.After that ,This servlet check whether user have registered or not and forward to appropriate page.




This pages is used to respond result that user repuested.


Friday, September 5, 2014

How To Init Servlet Parameters



Init servlet parameter



- When you create servlet you have to provide begin information for servlet.This information is called init param.These init param is gotten from method init(servletconfig config).Note that,these init is placed in config file,but not in code.

- So,to create a servlet you need to make the following steps.
 
  + Create servlet.
  + Override method init() with parameter config.
  +Finnaly,to get init config you use statment:config.getInitparam().

Develop Web Application


* To develop a web application you need to perform the following steps.
 
   -  Create new project.
      + choose java web and after that choose web application.


   - Name project and choose location to place project.


   - Choose server and version of java.


   - Servlet to server client.

     + right click on project and choose new ,after choose other and the click on servlet.



   - Name servlet and name package to place servlet file.






   - Click on finish.So we have finished to create a new servlet.


Thursday, September 4, 2014

Servlet Life Cycle


- The life cycle of servlet is:
   + create servlet class.
   + Instantiation and loading.
   + Innitailization init() method.
   + Allocating client reques to servlet.
   + Process client request service().
   + Destroy servlet when container feel that this servlet is not useful .After that,taking this servlet into garbage collection.

Note 1:
    + Servlet are a gereric server extension.They  run inside a java virtual machine.
    + Http servlet can generate an html page.
    + Http servlet can also be embeddes inside an html page,where it functions as a server-side include.
    + Servlet can be  chain together to produce complex effect.

Note 2:
    + In servlet, you realize that you don't find anywhere that have "new" keyword to create servlet object.So how servlet is created.In java web, programmer don't have to create servlet object,but server will create servlet object for you.
    + Server have purpose for helping you managing all resource.it mean that it creat,edit,deletle information .And by using server,you can develop a application more safety ,and the components run faster.

Hyper Text Transfer Protocol



- The request and the responses sent in the web application from one computer computer are sent using HTTP.HTTP client such as a web browser,open connection and send request message to an HTTP server for asking resource.The server,in turn,return response message with requested resource.Once the resource is delivered,the server close connection.

- The http is the protocol that is used to communicate on web environment.In fact,the http is not protocol,it is constructed on TCP and IP protocol.

- The features of the http protocol.

   +Http protocol is used to transfer file ,search facilities automatic format ....
   +Http is stateless protocol.It mean that it don't save states of client at the next time they login.
   +Web(http) server responds to the browser on request.
   +Http protocol is connectionless protocol.


Java Web Technologies

- There are a lot of technologies to make web applications by java such as javaservlet,javaserver pages,javaserver faces,ect...But today,you will rarely have to use javaservlet to make web applications.Because it is very difficult to design interface.Therefore,javadserver pages and javaserver faces were born to help programmer developing there web applications easily.In java ,everthing is written under object,class and everthing is servlet class.So if you write with any technologies,then things is based on servlet.As the result,you still have to learn javaservlet to understand clearly about technologies above.

Client Server Model


* What is the client server model ?

   - Client server model is the importaint model in application and web world today.This model consists of  a server and clients.Server is where provide bussiness logic,that handles requests from client and responds the particular information to client.Client is where interact with user that recieve information from user , after that send to server to able to receive a particular  response and display information for user.

   -Today there are a lot of application and web using the client server model such as if you want to copy a file from another computer,you would use a client to access the file on the server.In other words,the server serves data to the client.(Source: http://www.answers.com/Q/Example_of_client_server ).

* Why is it used ?
  
   -The client server model is used beacause it provide modern techniques such as object oriented model ,ect and this model has the hight security.

* When is it used ?

   -The client server model is used when you want to create a web application.That communicate user.

* Note: A application is the collection of program designed to perform a particular task.Different application are required for different purposes.Based on the layer on which application is run and the accessibility to be given to user ,the applications are classified as below:
   - Desktop application.
   - NetWork application.
   - Web application.

The advantages of web application over desktop application :
   - Easer access to inforamation.
   - Lower maintainane and deployment cost.
   - Platform independent.
   - Wider visibility.

The application has three components.The prensentation layer,the application layer ,also know as business layer and the data access layer.Based on this structure,following is the four application architecture:
   - One-tier architecture.
   - Two-tier architecture.
   - Three-tier architecture.
   - N-tier architecture.






















   

Wednesday, September 3, 2014

Flipped Learning Way


* How do you learn each objective of this course ?

- To learn each objective of this course.Everyone has to prepare the lessons before going to school such as watching video,taking the quizs and reading theory on the progress tracking and especially,you must do reflection carefully.If that is possible ,everybody also should do more exercises outside to improve the knowlege of theory and learn how to code clearly.

* What advantages and difficult when you apply this methodology ?

- The  Advantages:

  + The advantages of this methodology is to help you develop the ability of self-study.Therefore,you would not feel like fish out of water when you have to learn a new techonoly.That you have never been learned before.Thank to it,you would have more time to ask another person such as your teachers and your friends about problems that you have no idea to solve it.

 - The  Difficulties:

   +Beacause this is a new study way .So you will have to face a lot of difficulties such as how to learn this methodology ,and when you have problems at home,so how to solve this problems immediately beacause when you stay at home ,it is very difficult to find a friend who can help you to solve this problem.

* What is the most importaint acitivity in this course ?

  -In my opinion,the most importaint activity is to do reflection.Because this activity show you what you have done after learning this lesson.If you omit this activity, it mean that you have come back the traditional study way. :))