Java Servlet Interview Questions for Freshers Pdf - 1

Question: 1

What is JSTL?

JSTL is also called JSP tag libraries.

They are collection of custom actions which can be accessed as JSP tags.

Question: 2

What is the difference between JavaBeans and taglib directives?

JavaBeans and taglib fundamentals were introduced for reusability. But following are the major difference between them

Taglib are for generating presentation elements while JavaBeans are good for storing information and state.

Use custom tags to implement actions and JavaBeans to present information.

Question: 3

What are the differences between Servlets and Applets?

Servlets are server side components that runs on the Servlet container.

Applets are client components and run on the web browsers.

Servlets have no GUI interface.

Servlet are server side components that execute on the server whereas applets are client side components and execute on the web browser.

Applets have GUI interface but there is not GUI interface in case of Servlets.

 

Question: 4

What are the uses of Servlets?

Servlets are used to process the client request.

A Servlet can handle multiple requests concurrently and be used to develop high performance system.

A servlet can be used to load balance among several servers, as servlet can easily forward requests.

Question: 5

What is JSP Scriptlet?

JSP Scriptlet is a jsp tag which is used to enclose a java code in the JSP pages.

Scriptlets begins with <% tag and ends with %> tag. Java code written inside scriptlet executes every time the JSP is invoked.

Example:

<%

// java codes

String userName = null;

username = request.getParameter (“userName”) ;

%>

Related Questions