Without Book Interview Questions and Answers | Online Test | Moct Test
Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Institute Training Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

JSP Interview Questions and Answers

Ques 1. What is a JSP and what is it used for?

Ans. Java Server Pages (JSP) is a platform independent presentation layer technology that comes with SUN s J2EE platform. JSPs are normal HTML pages with Java code pieces embedded in them. JSP pages are saved to *.jsp files. A JSP compiler is used in the background to generate a Servlet from the JSP page.

Is it helpful? Add Comment View Comments
Ques 2. What is difference between custom JSP tags and beans?
Ans. Custom JSP tag is a tag you defined. You define how a tag, its attributes and its body are interpreted, and then group your tags into collections called tag libraries that can be used in any number of JSP files. To use custom JSP tags, you need to define three separate components:
1. the tag handler class that defines the tag\'s behavior
2. the tag library descriptor file that maps the XML element names to the tag implementations
3. the JSP file that uses the tag library
When the first two components are done, you can use the tag by using taglib directive:
<%@ taglib uri="xxx.tld" prefix="..." %>
Then you are ready to use the tags you defined. Let's say the tag prefix is test:
MyJSPTag or
JavaBeans are Java utility classes you defined. Beans have a standard format for Java classes. You use tags to declare a bean and use to set value of the bean class and use to get value of the bean class.

<%=identifier.getclassField() %>
Custom tags and beans accomplish the same goals -- encapsulating complex behavior into simple and accessible forms. There are several differences:
Custom tags can manipulate JSP content; beans cannot.
Complex operations can be reduced to a significantly simpler form with custom tags than with beans. Custom tags require quite a bit more work to set up than do beans.
Custom tags usually define relatively self-contained behavior, whereas beans are often defined in one servlet and used in a different servlet or JSP page.
Custom tags are available only in JSP 1.1 and later, but beans can be used in all JSP 1.x versions.
Is it helpful? Add Comment View Comments
Ques 3. What are the two kinds of comments in JSP and what's the difference between them ?
Ans. <%-- JSP Comment --%>
<!-- HTML Comment -->
Is it helpful? Add Comment View Comments
Ques 4. What is JSP technology?
Ans. he JavaServer Pages technology enables you to generate dynamic web content, such as HTML, DHTML, XHTML, and XML files, to include in a Web application. JSP files are one way to implement server-side dynamic page content. JSP files allow a Web server, such as Apache Tomcat, to add content dynamically to your HTML pages before they are sent to a requesting browser.
When you deploy a JSP file to a Web server that provides a servlet engine, it is preprocessed into a servlet that runs on the Web server. This is in contrast with client-side JavaScript™ (within SCRIPT tags), which is run in a browser. A JSP page is ideal for tasks that are better suited to execution on the server, such as accessing databases or calling Enterprise Java™ beans. You can create and edit a JSP file in the HTML editor by adding your own text and images using HTML, JSP tagging, or JavaScript, including Java source code inside of scriptlet tags. Typically, JSP files have the file extension .jsp. Additionally, the JSP specification suggests that JSP fragment files should have file extension .jspf. If this convention is not followed, the JSP validator will treat JSP fragments as regular standalone JSP files, and compilation errors might be reported.
Is it helpful? Add Comment View Comments
Ques 5. What is JSP page?
Ans. A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format such as HTML, SVG, WML, and XML, and JSP elements, which construct dynamic content.
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2016 WithoutBook