Sun River
Topics about Java SE, Servlet/JSP, JDBC, MultiThread, UML, Design Pattern, CSS, JavaScript, Maven, JBoss, Tomcat, ...
posts - 78,comments - 0,trackbacks - 0

Ajax isn’t a technology. It’s really several technologies, each flourishing in its own right, coming together in powerful new ways. Ajax incorporates:

Questions:

- Entry level:
  - Is AJAX a programming language?
  - What is AJAX?
  - How new is AJAX?
  - Why can/should AJAX be used?
 A: AJAX is best suited for small (hopefully unobtrusive) updates to the current
    web page, based on information that is not available until it has been provided
    by the end user.
  - When should AJAX NOT be used?
  A: It would not be appropriate to use AJAX when the "answer/result" can be determinded
    by the client.  Generally, the purpose of AJAX is to submit a short request to the server,
    and process the response in such a way as to add value to the currently displayed page.
    It would also not be appropriate to use AJAX when the magnitude of the response is such
    that it would be easier, and more clear to redisplay the page.

  - What objects are used by AJAX programs?

- Intermediate-level?
  - Describe the  formats and protocols used/specified by AJAX
  - Describe some things that can't be done with AJAX
 A: Sending a request to a server outside of the domain from which  the web page originated.
  - How should AJAX objects be created?
  - For what error conditions should programs check?
  - Are Finite State Machines (FSM's) appropriate for use with AJAX?
  - Identify and describe the state transitions that can/should occur within a transaction
A: - Reset : When the XmlHttpRequest object is created, no connection yet exists between the clent, and the server.
      Open  : When the xmlHttp.open() is issued, the request is being prepared for transmission to the server
      Sent   : When the xmlHttp.send() is issued, the request is transmitted to the server application
      Rcvd   : When the xmlHttp callback routine is called, the readyState and status fields of the object define why the routine was called

Q. How do you know that an AJAX request has completed?
A. The XHR.readyState is 4 and the XHR.status is 200 (or zero if the request is to a local file). The callback function is called four times - first with status=1, then 2,3, and finally 4.
Q. How does XML processing differ on the different browsers?
A. It's an ActiveX object on IE, but is native on the other browsers
Q: What values exists for the XmlHttpRequest.readyState field, and what do they mean?
A: readyState values:
    0 = uninitialized
    1 = loading
    2 = loaded
    3 = interactive
    4 = complete  


Other areas to check up on:
   How do you process the returned XML data?
   If it's a Java/J2EE place: what about AJAX and JSF?
   How to populate the XML response on the server?
   How to terminate an active request?

posted on 2006-10-05 10:09 Sun River 阅读(299) 评论(0)  编辑  收藏 所属分类: Java Script / Ajax