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 …
MVC Architecture Using Servlet And JSP
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Web Architecture Models Different programmers may design an application in different ways. Designing an application depends on how the programmers recognize the problem and approaches for solving that problem. A development model facilitates the design process by separating the code according to the functions performed by different …
sendRedirect in Servlet
Java EE Tutorials Servlets Tutorials Servlets Interview Questions In this article we shall see how to redirect your current page to some other page. The easiest way to achieve this is by using the sendRedirect() method of class javax.servlet.http.HttpServletResponse. sendRedirect() method redirects your current page to another servlet or jsp page. This method is used …
Servlet Context
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Servlet Context is used to communicate with the servlet container to get the details of web application. It is created at the time of deploying the project. There is only one Servlet Context for entire web application. Servlet Context parameter uses <context-param> tag in web.xml file. Methods of …
Web.xml
Java EE Tutorials Servlets Tutorials Servlets Interview Questions To understand web.xml, first let us uderstand what is xml? xml stands Extensible Markup Language. xml is markup language much like html. Xml defines set of rules for encoding document in a format that readable by both as human and machine. Xml was designed to carry and …
Servlet Example
Java EE Tutorials Servlets Tutorials Servlets Interview Questions Let us create a simple servlet example using Eclipse IDE. To create servlet application we need to use following steps: Environment used: JDK Eclipse IDE Apache Tomcat Server Java-api Open the Eclipse IDE and Go to File Menu ->New->Select Dynamic Web Project. Enter Project Name click on …