Hi Ranchers, I have planned to learn servlets and java in Netbeans IDE( I used netbeans for SCJP learning). I heard that netbeans will start tomcat by itself. No need to install tomcat seperately. Can anyone please help me how to set the classpath. I already set in command prompt like
1) Make sure you've created a Web Project (File>New Project>Web>Web Application). The wizard will let you choose an instance of Tomcat. 2) Do not put your code in the default package. This is generally bad practice and NetBeans especially hates it. 3) Get rid of the main method in your Servlet. 4) service() isn't the best method to override. doGet() would be more appropriate here. Don't worry about changing until after you get this working. 5) You need to map the Servlet in your web.xml. If you used the NetBeans wizard to create the Servlet, it will automatically create this mapping for you. (File>New File>Web>Servlet) 6. To start Tomcat, simply click the Run Main Project "play button" at the top or press F6. The build and Tomcat startup should display in your console window at the bottom. It will also automatically open a browser window pointing to the welcome page (index.jsp if you created your project with the wizard), which you my add Main to the end of the URL. There you'll see your Hello World
Joined: Jan 05, 2006
Thanks a lot Marc. That really helped to clear most of my doubts. But I have got the following error. Also, I don't understand step 5. But you told me that will create automatically by netbeans. Did you mean,configuration files folder that has web.xml file and when I openened that that showed Display name,Describtion,session timm out. Do I need to set anything here. Please help on this one too.
HTTP Status 404 - /Hello/HelloWorld
type Status report message /Hello/HelloWorld description The requested resource (/Hello/HelloWorld) is not available
My Updated coding is
[ February 07, 2008: Message edited by: Shiva Mohan ]