Java EE Tutorials Servlets Tutorials Servlets Interview Questions We can refresh the server in two ways Through client side and another through server side. Consider the webpage containing the live score of the match or any live activities we want to see in web page in such cases we have to either refresh the web …
OCEJWCD 6 Mock Exam – 7
1 . Consider the following code: Which of the following lines, when inserted at //1, will ensure that an IllegalStateException is NOT thrown? Choose the one below: res.clear(); res.empty(); res.remove(); if(!res.isCommitted()) if( res.getStatus() != res.COMMITTED) 2 . Which of the following statements are correct JSP directives? <%@ page %> <%! taglib uri=”http://www.abc.com/tags/util” prefix=”util” %> <% …
OCEJWCD 6 Mock Exam – 5
1 . Assume that the following header is present in a request sent to a servlet: What will be returned when the servlet code calls request.getHeader(“Accept”)? Choose the one below: A Header object containing, name as “Accept” and value as “image/gif” A Header object containing, name as “Accept” and value as “image/gif, image/jpeg, image/bmp” A …
OCEJWCD 6 Mock Exam – 4
1 . Consider the following web.xml code: Which of the following statements are correct? Choose the one below: The servlet code should use “manager” as a parameter in request.isUserInRole() method The servlet code can use “manager” or “supervisor” as a parameter in request.isUserInRole() method The servlet code should use”supervisor” as a parameter in request.isUserInRole() method …
OCEJWCD 6 Mock Exam – 3
1 . Regarding the processing of a BodyTag handler,in which of the following cases a BodyContent object will be “pushed” into the pageContext? If the doStartTag() returns EVAL_BODY_INCLUDE If the doStartTag() returns EVAL_BODY_BUFFERED If the doStartTag() returns SKIP_BODY If the doStartTag() DOES NOT return SKIP_BODY A BodyContent object it is always created and pushed no …
OCEJWCD 6 Mock Exam – 2
1 . You are using a tag library with prefix “generator”, which supports a tag named “random”.This tag generates a random number and sets it to a variable named “value”.Which of the following will output this value in the page? <generator:random>value</generator:random> <generator:random><%=value%></generator:random> <generator:random><% int value;%> <%=value%></generator:random> <generator:random><%getParameter(“value”)%></generator:random> None of the above 2 . Which of …
OCEJWCD 6 Mock Exam – 1
1 . A web.xml for a web application contains the following: What should formlogin.html contain? Choose the one below: A base 64 encoded username and password A header that prompts the browser to pop up the username/password dialog A form that POSTs to j_security_check url Any html page that does not require the user to …
How To Set PDF File Display In Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions In this article we will write a simple program which will write content to a PDF file. Example of writing data into PDF using Servlet. Create a Servlet called PDFDemo. Explanation: Content-Disposition in response header contains inline disposition type and file name attributes. inline is disposition type. …