Skip to main content

Posts

Showing posts from February, 2017

Java Servlets Part 5

Q) What are the steps involved in the development of a Java Web Application? Pre-Requisites • JDK 7(above version 5) • Eclipse IDE for Java EE Developers • Apache Tomcat 7.x • Servlet 2.5 (3.x is the latest version) Configure Apache Tomcat in eclipse IDE Step1: Open Eclipse IDE in Java EE perspective and in “Servers” area, right click -> New -> Server. Step 2: Here we will see a list of servers that can be configured in the installed Eclipse IDE version. You will find Tomcat v6.0 Server under “Apache” folder as shown below. Select “Tomcat v6.0 Server” and click Next. Step 3: Configure Apache Tomcat installation location. Select the Tomcat Root folder and click Next Previous Next

Java Servlets Part 4

Q) Explain about initialization phase of a servlet? • Servlet Container calling the init method of the user defined servlet is nothing but its initialization phase. • Initialization also happen's only once in the life time of a servlet. • During the initialization phase, Servlet Engine does two things. 1.) Creates ServletConfig object 2.) Calls init method by supplying • ServletConfig object reference as an argument. • Any resources required for the servlet to attend the client request are provided in init method. Q) Explain about servicing phase of a servlet? • Servlet Engine calling the service method of a user-defined servlet is nothing but its servicing phase. • Servlet Engine calls service method for every client request. • Servlet Container does two things during the servicing phase of a servlet. 1.) Creating ServletRequest object andServletResponse object 2.) Calling service method by supplying ServletRequest object referenceandServletResponse object

Java Servlets Part3

Q) What are the general duties of a servlet? Being a server side Java program, a servlet can do the following things in making the website dynamic. 1) Capturing the user input 2) Communicating with the database 3) Processing of data 4) Producing the response page 5) Handing over the response page to the web server Q) What are the constituents of a servlet? Servlet= Java code + HTMLcode Q) Explain about the life cycle of a servlet? Servlet life cycle is described through 3 life cycle methods and 4 phases. 1. Instantiation phase 2. Initialization phase 3. Service phase 4. Destruction phase Servlet container implicitly (automatically) calls these methods Q) What is the general structure of a simple servlet? public class RegistartionServlet implements Servlet { public void init(ServletConfigconfig) { //resources allocation Example: database connection creation, PreparedSatement creation } public void service(ServletRequestrequest,ServletRes

Java Servlets part 2

Q) What is a Java based (dynamic) website? If a website is made dynamic (interactive) by using the following things, it is called as a Java based website. 1. Java as programming language(server side programming) 2. Servlets & JSP as web technologies 3. JDBC as data access technology Q) What is not Servlets? • Servlets is not a programming language, unlike Java. • Servlets is not a software to be installed on a computer system (to develop web applications). Q) What is the purpose of Servlet technology? Servlet technology is used in Java based web application development. OR Servlet technology is used in the implementation of Java based web-enabled enterprise applications. OR Servlet technology is used in Java-based dynamic website development. Q) What is Web Container? Web Container is server software with 3 modules. 1. web server 2. Servlet Container (Engine) 3. JSP Container (Engine) Example: Tomcat Q) What is the need of web container for a Java web applica

Coming soon

java servlets

We can create dynamic websites using core technologies of java like Servlets and JSP’s. Q) What is a website? ·           A website is a collection of webpages that mostly belong to one organization (enterprise). ·           A webpage is a  document , typically written in  plain text   with formatting instructions of Hypertext Markup Language ( HTML ,  XHTML ).  ·           A website is hosted into a web server machine and has a unique URL known as host name(domain name).Web pages are accessed from the website using its URL (domain name) called the  web address . ·           A collection of publicly accessible websites is nothing but  World Wide Web . ·           Web pages communicate with Web Server using HTTP (Hyper Text Transfer Protocol) to access web pages. ·           Web clients communicate with Web Server using HTTP (Hyper Text Transfer Protocol) to access web pages. ·           Web client is a browser on your PC that makes request to the remote server ·           As web cli