Your Ad Here
Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Wednesday, December 31, 2008

JSP Interview Questions & Answers

Q : What is a JSP and what is it used for?
A : Java Server Pages is a platform independent presentation layer technology that comes with SUN s J2EE platform. JSPs are normal HTML pages are with Java code pieces embedded in them. JSP pages are saved to *.jsp files. A JSP compiler is used to in the background to generate a Servlet from the JSP page.

Q : What is JSP technology?
A : Java Server Page is a standard Java extension that is defined on top of the servlet Extensions. The goal of JSP is the simplified creation and management of dynamic Web pages. JSPs are secure, platform-independent, and the best of all, make use of Java as a server-side scripting language.

Q : How many JSP scripting elements ?
A : There are three JSP scripting language elements:
• Scriptlets
• Declarations
• Expressions

Q : What is the information needed to create a TCP Socket?

A : The Remote System’s IPAddress and Port Number.
The Local Systems IP Address and Port Number.

Q : What is difference between JSP 1.0 model and JSP 2.0 model?

A : The main difference between the JSP 1.0 and JSP 2.0 has feature in that by which we can create more syntax errors due to TLD.

Q :Diffrence betweeen a statis and dynamic include?

Dynamic include means files are included at run time.
If there is any change in source file it will reflected in JSP
Static include means files are included at compile time. After inclusion if there any change in source file it will not reflect that JSP.

Q : What’s the differences between JSP LifeCycle and Servlet LifeCycle?
A : In servlet we can implement init, service and destroy method but in JSP we do not have any implementation for that i.e JSP container is taking care of that implementation . Finally only translation phase is different i.e JSP converted into servlet.

Q : What is the difference between web server and application server?
A : Application server is EJB. It can communicate will both Web and Distributed Architecture. Application server is a Component Architecture
Web server can not communicate with Component Architecture or Distributed Architecture. It consists of Servlets and JSP pages.

Q : How to Upload a textfile from JSP to Servlet ?
A . You must use this tag for Remember form tag must contain the following attribute

Enctype ="multipart/form-data" then only it will validate file upload.

Q : What’s the difference between JSP forward and servlet forward methods?

A : JSP forward forwards the control to another resource available in the same web application on the same container. where as a Servlet forward forwards the control to another resource available in the same web application or different web application on the same container.

Q : How to call EJB from JSP.?
We need to write a JavaBean which implements the code for the EJB client. This is JavaBean can interact with the JSP using useBean JSP action.

Q : What is the difference between jsp include and directive include?
A : <%@ include> : Used to include dynamic content or static content during runtime
Used to include static resources during translation time. :

Q : How does JSP handle runtime exceptions?
A: Using the error Page attribute of page directive and also we need to specify the error page isErrorPage=true if the current page is intended to URL redirecting of a JSP.

Q : What are the implicit objects?
A : Implicit objects are objects that are created by the web container and contain the information related to a particular request, page, or application. They are:
• Request
• session
• response
• pageContext
• application
• out
• exception
• config
• page

Q : What is an Expression?

A : An expression is a tag contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file. Because the value of an expression is converted to a String, you can use an expression within text in a JSP file. Like
<%= someexpression %>
<%= (new java.util.Date()).toLocaleString() %> You won’t use the semicolon to end an expression.

XML Interview Questions & Answers

Q : How can u create an XML file?
A : It is a quite easy to create, can create by the plain text editor like notepad or by .net model using so many in built methods like XmlTextWriter etc.

Q : What is a XML Namespace?
A : Defining a namespace to avoid the confusion involves using a prefix and adding an xmlns attribute to the tag to give the prefix a qualified name associated with the namespace. All the child elements with the same prefix are associated with the namespace defined in the start tag of an element.

Q : What’s the difference between SAX parser and DOM parser?
A : SAX parser - works incrementally and generate the events that are passed to the application. It does not generate data representation of xml content so some programming is required. However, it provides the stream processing and partial processing which cannot be done alone by DOM parser.
DOM parser - reads the whole XML document and returns a DOM tree representation of xml document. It provides a convenient way for reading, analyzing and manipulating XML files. It is not well a suited for the large xml files, as it always reads the whole file before processing.

Q : Describe the differences between XML and HTML?
A : XML :
• User definable tags
• Content driven End tags required for well formed documents
• Quotes required around attributes values
• Slash required in empty tags

HTML :
• Defined set of tags designed for web display
• Format driven
• End tags not required
• Quotes not required
• Slash not required

Q : What is DOM?
A : The Document Object Model (DOM) is an interface specification maintained by the W3C DOM Workgroup that defines is an application independent mechanism
to access, parse, or update XML data. In the simple terms it is a hierarchical model that allows developers to manipulate XML documents easily.

Q :Why is XML such an important development?
A : XML removes the two constraints which were holding the back Web developments: dependence on a single, inflexible document type (HTML); the complexity of full SGML.

Q : What is a XPointer?
A : XPointer is a set of recommendations developed by the W3C. The core recommendations are the XPointer Framework which provides an extensible addressing behavior for fragment identifiers in XML media types.
XPointer gains its extensibility through the XPointer Framework, which identifies the syntax and processing architecture for XPointer expressions and through an extensible set of XPointer addressing schemes. These schemes, e.g., element() or xpointer(), are actually QNames. The xmlns() scheme makes it possible for an XPointer to declare namespace bindings and thereby the use third-party schemes as readily as W3C defined XPointer schemes.

Q : What is the three essential components of security does the XML Signatures provide?
A : Authentication, message integrity, and non-repudiation. In addition to signature information, an XML Signature can also contain the information describing the key used to sign the content.

Q :What’s an XML namespace prefix?
A : An XML namespace prefix is a prefix used to specify that a local element type or attribute name is in a particular XML namespace.

Q : Why is XML such an important development?
A : XML removes the two constraints which were holding back Web developments:
1. Dependence on a single, inflexible document type (HTML) which was being much abused for tasks it was never designed for;
2. The complexity of full SGML, whose syntax allows many powerful but hard-to-program options.
XML allows the flexible development of user-defined document types. It provides a robust, non-proprietary, persistent, and verifiable file format for the storage and the transmission of text and data both on and off the Web, and it’s remove the more complex options of SGML, making it easier to program for.

Your Ad Here