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. …
How To Initialize Variables In Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions While developing web applications (servlets), some data elements are required to process the request at the development phase. For example, in login application we need to enter user name and password. But user name and password are available only at the time of deploying the application. Instead …
ServletInputStream and ServletOutputStream
Java EE Tutorials Servlets Tutorials Servlets Interview Questions javax.servlet.ServletInputStream and javax.servlet.ServletOutputStream are abstract classes. These classes define several key methods that the other stream classes implement. Two of the most important methods are read( ) and write( ), which are used for reading the client request and writing servlet response to client respectively. ServletInputStream The …
Difference Between Forward And sendRedirect In Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions First let us list the differences between the forward() and sendRedirect() methods. Then we will see an example for each: forward() sendRedirect() The forward() method is executed in the server side. The sendRedirect() method is executed in the client side. The request is transfer to other resource …
OCPJBCD Mock Exam – 4
1 . Which of the following statements are true about the Entity class? Entity class must not have no-arg constructor Entity class must be declared as top level class Interface cannot be Entity Enum can be declared as Entity 2 . Which of the following are correct? Choose the one below: 1 2 3 4 …
OCPJBCD Mock Exam – 3
1 . A stateless session bean must commit a transaction before a business method? True False 2 . A message-driven bean must commit a transaction before a business method? True False 3 . A stateful session bean must commit a transaction before a business method? True False 4 . By default, What is the value …
OCPJBCD Mock Exam – 2
1 . Can we use the annotation @PrePassivate for more than one method in a bean? Yes No 2 . What should be the return type of the method using @PrePassivate? Object void String boolean 3 . Which of the following are correct statements about @PrePassivate? Method’s return value must not be void Method cannot …