Questions and answers taken from real job interviews.
Find interview questions and answers on this website:
Usability Issues: a. User Exceptions b. Response time c. Design Issues d. Accessibility
Ajax Objects can be created by the following syntax: Var ajax= New ajaxObject('page path'). Here page path is the URL you want the Object to call. The URL must be of the same domain as the webpage.
This is done by using JavaScipt closures. Functions can be written to handle such requests. Parameters can be passed to an appropriate function selected by closures. JavaScipt closures can be used for handling concurrent requests. A function can be written to handle such requests. Once processing of code is over, URL and the call back function to call can be passed as parameters. These parameters are passed to the AJAXInteraction(url, callback) object. Closures insure that the proper callback function associated with a specific AJAX interaction is called.
• The AccordionExtender control is almost same as the CollapsiblePanelExtender control. • It enables the grouping of multiple collapsible panels in a single control. • It also manages the collapsed and expanded state of every panel and one panel will expand at a time. • Using AccordionExtender control we can't expand two or more panels at a time. However, we can click the header templates of particular panel to display the hidden contents. • By default, one panel is always expanded in theAccordionExtender.
• The client web page is creates the XmlHttpRequest, and thus the connection from the web page to an application on the server. • Part of that connection determines how the response can be produced to the client code - via the use of a ''callback'' routine. • The callback routine is called multiple times which come with a status code which indicates the reason for the invocation. • When a request can be successfully completed by the server application, a response should also be produced.
Absolutely. Java is a great fit for AJAX! We can use Java Enterprise Edition servers to generate AJAX client pages and to serve incoming AJAX requests, manage server side state for AJAX clients, and connect AJAX clients toy our enterprise resources. The JavaServerFaces component model is a great fit for defining and using AJAX components.
XMLHttpRequest is an object used for data transfer with server and client's browser. This object allows the data transfer without reloading the page. The data transfer takes place in plain text xml or JSON format. This object allows to parses the xml format. It is recognized by all the browsers xmlOBJ = new XMLHttpRequest ()
AJAX allows for asynchronous processing of events. This is different from the traditional sequential events that a users is used to, instead, a user can fire multiple events, each of which process executes independent of each other, enhancing the user experience. In traditional web applications, every time a user triggered an event, the request was sent to the server and the complete page was rendered again as a result of that. AJAX allows for partial page rendering which enable a user to trigger multiple events through different portions of the same web page.
In order to store changes in the browsers web history (enabling back and forward buttons) Iframes can be used. Iframes allow am HTML document to be embedded in another HTML document. RSH (Really Simple History) framework can also be used. RSH framework explains the management of bookmarks and history for Ajax applications.
readyState allows determining the request status. If the value is 4, it means that the request has been completed and response is then sent to the browser. By determining the readyState property value of XMLHttpReqyest, One can know if the request is completed. If the readyState value = 4, the request has been completed and the data is available.
Ways to handle encoding in AJAX: • Using encodeActionURL() method to refresh the complete page • Using encodeResourceURL() method to partially update a page.
The following validation controls are supported in ASP.NET AJAX 4.0: • FilteredTextBoxExtender : This validation is used to apply filtering to a text box. • MaskedEditExtender and MaskedEditValidator : These validation controls are used to prevent a user to enter only a particular pattern of characters in the TextBox. • ValidatorCalloutExtender : This validation is used to display a balloon tooltip containing the error message by attaching the ASP.NET validators. • NoBot : It restricts the input forms automatically to be filled by spam/bot and used to ensure that the user is not a computer machine by the automated Public Turing test. • PasswordStrengthExtender : It is used to find the strength of the password entered in the text box by checking the different strength related parameters.
We can execute following functions when there is an input in the text field. • 1) Defines the url that we will sent to the server • 2) A parameter is inserted to the input field's content. • 3) A parameter is inserted to restrict the server from the cache. • 4) When a change is triggered statechange is invoked. • 5) An XMLHTTP object having a given URL gets invoked • 6) A request is sent to the server through HTTP.
Yes by using ActiveXObject, it is possible to implement AJAX in browsers that do not support the XmlHttpRequest object.
All the available browsers can not support AJAX. Here is the list of major browsers which support AJAX. 1. Mozilla Firefox 1.0 and above 2. Netscape version 7.1 and above 3. Apple Safari 1.2 and above. 4. Microsoft Internet Exporer 5 and above 5. Konqueror 6. Opera 7.6 and above
The different states of the XMLHttpRequest object are as follows: • 1) Uninitialized : It is the state in which the object has not been initialized. • 2) Open: It is the state when the object has been created but the send function is not invoked. • 3) Sent: It is the state when the send function is invoked but the status and headers are not available. • 4) Receiving: It is the state when the data is received by the process. • 5) Loaded: It is the state when the procedure is completed and the data is available.
• Html based web applications are easily searchable & can be indexed. • Startup time to load a applets is more that loading a page with ajax. • Applets provides a different look and feel than a normal web based application The following are the benefits of AJAX over Java applet: • AJAX applications are loaded in seconds, where as Applets takes longer time. The reason is, Applet applications are tend to load large libraries. • AJAX provides standard look and feel for web applications, where as Applets provides GUI based look and feel. • AJAX features can increase from a conventional web application, where as Applets uses complete programming process right from the scratch. • Java version changes enable incompatibilities between Applet and java environments used by the browser, where as in AJAX incompatibilities are not the constraints.
The new features included in the Microsoft AJAX library are as follows: • Imperative syntax: AJAX library provide simple imperative syntax which is required to create and manage controls. • Script loader: It is used to retrieve all scripts automatically which are required by one or more client component or control and executes them in the order in which they are received. • Client data access: It's used to access client data and display by client data control and client template. • Client datacontext: It's used to read and write the permission to data in a database. • The AdoNetDataContext class - Supports to easily communicate to an ADO.NET Data Services service.
The Ajax calls are sent in plain text format, this might lead to insecure database access. The data gets stored on the clients browser, thus making the data available to anyone. It also allows monitoring browsing sessions by inserting scripts. AJAX function calls are sent in plain text to server. These calls may easily reveal database details, variable names etc User's browsing session can be monitored my maliciously inserting scripts Ajax may encourage developers to use multiple server side pages thereby introducing multiple entry points for attackers
• An UpdatePanel control is a cover for server side controls which is to be partial postbacked on ajax enabled page. • All controls included in the UpdatePanel will be partial postbacked. Below is a small example of using an UpdatePanel. <asp:ScriptManager runat=''server''> </ asp:ScriptManager> <asp:UpdatePanel runat=''server''> <ContentTemplate> <asp:Button runat=''server''></asp:Button> </ContentTemplate> </asp:UpdatePanel> • On clicking the button the page will be updated partially. There won't be a full postback by the web page. • In this way the content beyond the update panel won't be posted back to the server. • The contents in the updatepanel will be refreshed only.
Synchronous request means that the processing will stop once the request has been sent to the server till the reply comes back. The browser freezes and you are not allowed to perform any task or send any request.
The difference between synchronous and asynchronous postback is as follows: • Asynchronous postback renders only the part of the page which is needed; while, synchronous postback renders the entire page in a postback. • Asynchronous postback executes only one postback at a time, that is, if you have two buttons doing asynchronous postback, the actions are executed one by one; while, synchronous postback invoke all the actions at a time. • Asynchronous postback only changes the update panel that invoke the postback; while, synchronous postback changes the entire page.
The disadvantages of AJAX are: • Search engines would not be able to index an AJAX application. • The server information can not be accessed within AJAX. • AJAX is not well integrated with any browser. • ActiveX requests are enabled only in IE 5 and IE6 • Data of all requests is URL-encoded, which increases the size of the request.
The ScriptManager controls client script for ASP.NET AJAX pages. It also registers the script for the AJAX Library.
ScriptManager is a class and a control in Ajax. The ScriptManager class in ASP.NET manages Ajax Script Libraries, partial page rendering functionality and client proxy class generation by creating an instance of the Ajax runtime on the browser, for web applications and services. The ScriptManager control (that we may drag on a web form) is actually an instance of the ScriptManager class that we put on a web page. The ScriptManager manages all the ASP.NET Ajax controls on a web page.
Scenarios to use Java applet instead of AJAX: • When there is a need for custom data streaming • Need for graphic manipulation • Threading related functionality • Complex and advanced GUI manipulations.
• Back functionality can't work because the dynamic pages won't register themselves to the browsers cache. Hence the use Iframe will become required. • The page cannot be bookmarked if it is developed using Ajax. • If java script is not enabled, Ajax will stop working. • Because different components of the pages are loaded at different times, response time may be slow. • Because different components of the pages are loaded at different times it may create confusion for the user.
• Timer: This control is used to refresh the contents of a web page at already specified intervals of time. • Script Manager: This is the heart of an AJAX enabled web page. To develop the partial page rendering, it is necessary to set the EnablePartialRendering property of the ScriptManager control to true. • ScriptManagerProxy: A ScriptManagerProxy control passes references to a ScriptManager control in a master page to declare the Ajax behavior. • UpdateProgress: This control is required to display the progress when an update action in partial page rendering process is in progress. • UpdatePanel :- Update panel is required to create partial page updates in an Ajax enabled web page. All the controls which we need to involve in partial page update we need to include them inside an UpdatePanel control.
AJAX requests should use an HTTP GET request while retrieving data where the data does not change for a given URL requested. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idempotency recommendations and is highly recommended for a consistent web application architecture.
It is because java provides Java enterprise Edition servers for generation of AJAX client pages to serve ajax requests.