What is meant by implicit objects and what are they ?
Answer:
JSP implicit objects are those Java objects that the JSP Container makes available to developers in each page. A developer can call them directly, without being explicitly declared. JSP Implicit Objects are also called pre-defined variables.The following objects are considered implicit in a JSP page:
application
page
request
response
session
exception
out
config
pageContext
What are Expressions ?
Answer:
A JSP expression is used to insert the value of a scripting language expression, converted into a string, into the data stream returned to the client, by the web server. Expressions are defined between <% = and %>
tags.
What are Decalarations ?
Answer:
Declarations are similar to variable declarations in Java. Declarations are used to declare variables for subsequent use in expressions or scriptlets. To add a declaration, you must use the sequences to enclose your declarations.
ViewWhat are Scriptlets ?
Answer:
In Java Server Pages (JSP) technology, a scriptlet is a piece of Java-code embedded in a JSP page. The scriptlet is everything inside the tags. Between these tags, a user can add any valid scriplet.
ViewWhat are JSP actions ?
Answer:
JSP actions use constructs in XML syntax to control the behavior of the servlet engine. JSP actions are executed when a JSP page is requested. They can be dynamically inserted into a file, re-use JavaBeans components, forward the user to another page, or generate HTML for the Java plugin.Some of the available actions are listed below:
jsp:include
– includes a file, when the JSP page is requested.jsp:useBean
– finds or instantiates a JavaBean.jsp:setProperty
– sets the property of a JavaBean.jsp:getProperty
– gets the property of a JavaBean.jsp:forward
– forwards the requester to a new page.jsp:plugin
– generates browser-specific code.What are Directives ? What are the different types of Directives available in JSP ?
Answer:
Directives are instructions that are processed by the JSP engine, when the page is compiled to a servlet. Directives are used to set page-level instructions, insert data from external files, and specify custom tag libraries. Directives are defined between < %@ and % >
.The different types of directives are shown below:
Include directive
: it is used to include a file and merges the content of the file with the current page.Page directive
: it is used to define specific attributes in the JSP page, like error page and buffer.Taglib
: it is used to declare a custom tag library which is used in the page.What are the advantages of JSP ?
Answer:
The advantages of using the JSP technology are shown below:
How are the JSP requests handled ?
Answer:
On the arrival of a JSP request, the browser first requests a page with a .jsp extension. Then, the Web server reads the request and using the JSP compiler, the Web server converts the JSP page into a servlet class. Notice that the JSP file is compiled only on the first request of the page, or if the JSP file has changed.The generated servlet class is invoked, in order to handle the browser’s request. Once the execution of the request is over, the servlet sends a response back to the client. See how to get Request parameters in a JSP.
ViewWhat is a JSP Page ?
Answer:
A Java Server Page (JSP) is a text document that contains two types of text: static data and JSP elements. Static data can be expressed in any text-based format, such as HTML or XML. JSP is a technology that mixes static content with dynamically-generated content. See JSP example here.
ViewWhat is URL Encoding and URL Decoding ?
Answer:
The URL encoding procedure is responsible for replacing all the spaces and every other extra special character of a URL, into their corresponding Hex representation. In correspondence, URL decoding is the exact opposite procedure.
ViewWhat’s the difference between sendRedirect and forward methods ?
Answer:
The sendRedirect method creates a new request, while the forward method just forwards a request to a new target. The previous request scope objects are not available after a redirect, because it results in a new request. On the other hand, the previous request scope objects are available after forwarding. FInally, in general, the sendRedirect method is considered to be slower compare to the forward method.
ViewWhat is HTTP Tunneling ?
Answer:
HTTP Tunneling is a technique by which, communications performed using various network protocols are encapsulated using the HTTP or HTTPS protocols. The HTTP protocol therefore acts as a wrapper for a channel that the network protocol being tunneled uses to communicate. The masking of other protocol requests as HTTP requests is HTTP Tunneling.
ViewWhich protocol will be used by browser and servlet to communicate ?
Answer:
The browser communicates with a servlet by using the HTTP protocol.
ViewWhat is a cookie ? What is the difference between session and cookie ?
Answer:
A cookie is a bit of information that the Web server sends to the browser. The browser stores the cookies for each Web server in a local file. In a future request, the browser, along with the request, sends all stored cookies for that specific Web server.The differences between session and a cookie are the following:
What is the structure of the HTTP response ?
Answer:
The HTTP response consists of three parts:
How do you find out what client machine is making a request to your servlet ?
Answer:
The ServletRequest class has functions for finding out the IP address or host name of the client machine. getRemoteAddr() gets the IP address of the client machine and getRemoteHost() gets the host name of the client machine. See example here.
ViewWhat is Servlet Chaining ?
Answer:
Servlet Chaining is the method where the output of one servlet is sent to a second servlet. The output of the second servlet can be sent to a third servlet, and so on. The last servlet in the chain is responsible for sending the response to the client.
ViewWhat is a Server Side Include (SSI) ?
Answer:
Server Side Includes (SSI) is a simple interpreted server-side scripting language, used almost exclusively for the Web, and is embedded with a servlet tag. The most frequent use of SSI is to include the contents of one or more files into a Web page on a Web server. When a Web page is accessed by a browser, the Web server replaces the servlet tag in that Web page with the hyper text generated by the corresponding servlet.
ViewWhat is meant by a Web Application ?
Answer:
A Web application is a dynamic extension of a Web or application server. There are two types of web applications: presentation-oriented and service-oriented. A presentation-oriented Web application generates interactive web pages, which contain various types of markup language and dynamic content in response to requests. On the other hand, a service-oriented web application implements the endpoint of a web service. In general, a Web application can be seen as a collection of servlets installed under a specific subset of the server’s URL namespace.
ViewWhat is the difference between doGet() and doPost() ?
Answer:
doGET
: The GET method appends the name-value pairs on the request’s URL. Thus, there is a limit on the number of characters and subsequently on the number of values that can be used in a client’s request. Furthermore, the values of the request are made visible and thus, sensitive information must not be passed in that way. doPOST
: The POST method overcomes the limit imposed by the GET request, by sending the values of the request inside its body. Also, there is no limitations on the number of values to be sent across. Finally, the sensitive information passed through a POST request is not visible to an external client.
© 2017 QuizBucket.org