When you are working with the JNDI look up, quite often you would encounter the javax.naming.NameNotFoundException thrown by your application. JNDI names are registered in the registery, if you try to access the name which is not registered or by the wrong format, you would get the javax.naming.NameNotFoundException. Lets look at the below code for …
Java EE
Cookies In Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Cookies are text data sent by server to the client and it gets saved at the client local machine. This is a small bits of information that a web browser send to browser and that are browser returns unchanged after visiting the same page. Server can accept multiple …
How To Get Client IP Address In Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions The host name and IP address of the client requesting the servlet can be obtained using the HttpRequest object. In the following section we have a detailed java code to get clients address in a servlet. If the client uses proxy server , the real request to …
Request Headers In Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Request Header Request header is used to pass additional information about the request or itself to the server. Request header can be used by client to pass useful information. getHeaderNames() and getHeader() methods of javax.servlet.http.HttpServletRequest interface can be used to get the header information. Following important request header …
How To Refresh Servlet
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 …
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. …
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 …