Servlet Program - Smart Tech Guides

Latest

Hi this is Sravan Kumar from India. SMART TECH GUIDES is a technical blog. it helps you to learn about Java topics, frameworks and tools like Jenkins, GitHub & related explanations, data base related topics. All these Explanations are explained in simple and understandable manner.

Subscribe Us

SMART TECH GUIDES

Servlet Program

Steps To Develop Web Application using Java 


1) select new dynamic web project from editor(Eclipse), and write project name, package name and  class name. 

2) servlet components are web components we need servlet API to create web components, servlet API is not available inside JRE, so we need to add servlet API explicitly.

select created Java project and add servlet API, from external jar location, it is available inside configure build path.

build path


3) servlets program executed inside servlet container, servlet container available inside web server like tomcat so we should add server to Java class path.


after adding servlet API and server(tomcat), our setup is almost ready.


4) write code. 


Java Code


here service method is request processing method, it is an abstract method available inside GenericServlet class. we are writing our own business logic inside this method.


5) create Html file for displaying result on browser.


index.html

 

6) Finally, we need to map our servlet program with URL pattern inside WEB-INF.


because our tomcat server looking the servlet component with its mapping URLs. 


web.xml

No comments:

Post a Comment