Home Answers Viewqa Java-Beginners advance java question

 
 


Robin Sharma
advance java question
1 Answer(s)      2 years and 5 months ago
Posted in : Java Beginners

how to develop servlets without using any IDE such as netbeans..

View Answers

December 23, 2010 at 4:35 PM


Hello Friend,

Follow these steps:

Put servlet-api.jar inside the lib folder of apache tomcat. 1)create a servlet.

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet{ 
  public void doGet(HttpServletRequest request, HttpServletResponse response)
                                   throws ServletException,IOException{
    response.setContentType("text/html");
    PrintWriter pw = response.getWriter();
    pw.println("<html>");
    pw.println("<head><title>Hello World</title></title>");
    pw.println("<body>");
    pw.println("<h1>Hello World</h1>");
    pw.println("</body></html>");
  }
}

2)Go to the webapps folder of your apache tomcat and create a web application folder but it should having an appropriate name like examples.

3)Create web.xml and classes folder inside the WEB_INF folder of web application folder.

4)Copy the servlet to the classes folder.

5)Edit the web.xml to include servlet?s name and url pattern.

<web-app>
 <servlet>
  <servlet-name>HelloWorld</servlet-name>
  <servlet-class>HelloWorld</servlet-class>
 </servlet>
 <servlet-mapping>
 <servlet-name>HelloWorld</servlet-name>
 <url-pattern>/HelloWorld</url-pattern>
 </servlet-mapping>
</web-app>

6)Compile your servlet.

7)Run Tomcat server by clicking the startup.bat file. This is located inside the bin folder of apache tomcat.

8)Open the browser and type the following url:

http://localhost:8080/webapplicationfoldername/HelloWorld

For more information, visit the following links:

http://www.roseindia.net/servlets/introductiontoconfigrationservlet.shtml

http://www.roseindia.net/servlets/HelloWorld.shtml

Thanks









Related Pages:
advance java question
advance java question  how to develop servlets without using any IDE such as netbeans..   Hello Friend, Follow these steps: Put servlet-api.jar inside the lib folder of apache tomcat. 1)create a servlet. import
advance java
advance java  give the sourse code for sky high institute of management using j2ee
advance java
advance java  i want to refer advanced java book can u plz suggest me auther name   You can learn from the following books: 1)Advanced Java, Gajendra Gupta 2)Core servlets and JavaServer Pages,Marty Hall
Advance Java
Advance Java  Context ctx = new InitialContext(); if(ctx==null) { throw new RuntimeException("JNDI Context not Found"); } ds=(DataSource)ctx.lookup
advance java
advance java  what is servlet context?why its used?in what situation we should use it in our program?   Hi Friend, ServletContext is an interface that is defined in the javax.servlet package. It describes a set
Advance Java Training Program
Advance Java Training Program  Hi, Can anyone guide me how to study advance Java in few day's  Please visit the following link: Java Tutorials Through the above link, you will get the links of advanced java tutorials
Advance and Core JAVA Topics
Advance and Core JAVA Topics  topics come under core java and topics come under advanced java?   Under Core Java, following topics comes... JDBC Under Advanced Java, following topics comes: Generics Reflection
Advance Java training topics
Advance Java training topics     ... simple JSPs that use Java code in declarations, expressions and scriptlets... Java exception handling and JSP error pages to handle errors   
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
Question
Question   When there is an exception in my program how java runtime system handles
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
question
question  hai.......... i have one doubt can i have two actions for one button. please reply me soon thanks in advance
question
question  Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some... me the answeres for previous queries.. Thanks in advance teja   Hi
question
question  how to capture web snippets using java or java script
question
question  why java is platform independent in nature
question
question  how to solve the problem of The requested resource is not available+java+eclipse
question
question  select from table using jsp , java bean and mysql
QUESTION
QUESTION  please atach java tutorial to my email   Hello Friend, Please visit the following link: Java Tutorial Thanks
question
question  which language is leading the world java or .net and which language followed by all the Oops principles either java or .net
question
question  do you have any idea about the following concept,give me Java code for A COMPARATIVE STUDY ON PERSONALIZATION IN INFORMATION RETRIEVAL WITH SHARING OF THE CONCEPT BASED USER PROFILES using Java
question
question  Dear Sir, could you please send me a simple example of java and database connectivity with java and sql   Please visit the following link: JDBC Tutorials
question
question  Good Afternoon, code to display the employees on leave,and approve that leave for manager.using JPanel+mysql+Java
question
question  i need a code for time comparison in the basis of hour in java, based on grigorian calendar
question
question  i need a sample java code for concept based user profile, and search engine personalization
question
question  Please give me a code for search engine using java and mysql
question
question  Good afternoon Sir, please send me the Java source code for Search engine
question
question  Sir, Please help me to develop a simple search engine model in java , send me some codes
question
question  Good Morning Sir, Please give me Java source code for Peer-to-Peer Streaming
question
question  Sir, Please give me a source code for client server socket programing in java
question
question  Sir, Please send me Java Swing source code for video streaming , it's very urgent
Question
Question  Sir, give me a java program to count the number of tokens , given a string and a seperator
java tricky question
java tricky question  can we have dynamic polymorphism without overriding in java..?? I know tht itz possible..but hav no idea how..? can any1 help me out. Thanks in advance
question
question  how to unzip afile using huffman algorithm in java   Hi, Please see at Huffman example. Thanks
question
question  Good Morning Sir, submit attendance to database using system IP address with current system date and time.using JPanel+mysql+Java
question
question  Good afternoon Sir, how to solve the problem of The requested resource is not available+java+eclipse if you can play a demo
question
question  i need to select data from database using mysql+java script+html   Please specify some more details
question
question  Good Afternoon Sir, Please give me a client Server Socket programming using jsp and java with mysql connection
Question
Question  Sir, give me a Java program to read data from keyboard up to names , sort in alphabetical order using bubble sort
question
question  Good Afternoon Sir, give me the source code to submit attendance to data base using System IP Address with system date and time.using JPanel+mysql+java
question
question  good afternoon sir, please send me a simple Jsp or Java code to display a calendar with Indian public holidays,current date and time.It is very urgent,please consider and me as soon as possible
question
question  please give me the relevant modules and details to start java coding for "Deriving Concept-based User Profiles from Search Engine Logs" it's very urgent
question
question  Sir , i have a starting trouble to start my search engine project , please help me to start my project , please send me some relevant java codes
question
question  Sir, how to display web snippets for a perticular query for eg:web snippets for apple how to implement this concept in my java project please help me
question
question  Sir, How to stream video on one computer which is playing on another PC in LAN using java + socket / RMI . if you have any idea about that please help me and give the source code
question
Action in JSP  more than one actions done in a jsp in struts2 and controll go in different java class   Have a look at the following link: Sruts Tutorials
Question
Question  Sir, please help me to write a JAVA program to read data from keyboard up to names and sort in alphabetical order using bubble sort
question
question  Sir, If i have a frame with two button sign in and cancell using java swing .If i am clicking a sign in button using user name... the source code using Java Swing
question
question  Dear Sir, Could you please send me a simple and standard example including Java bean class , use of that bean class in JSP   ...://www.roseindia.net/jsp/loginbean.shtml http://www.roseindia.net/jsp/java-beans.shtml
Question
java interview questions and answers for one year experianced candidates  Good afternoon sir could you please send me program style java interview questions and answers for one year experianced candidates.ie ,the questions like

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.