Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » tomcat + dynamic web project
tomcat + dynamic web project [message #685941] Mon, 20 June 2011 20:54 Go to next message
moaad Mising name is currently offline moaad Mising nameFriend
Messages: 7
Registered: June 2011
Junior Member
Hello everybody

I'm using Eclipse Helios IDE
I have created a Dynamic Web application called : "first_appli". However I've noticed that the structure of the Web application is little bit weird.
In fact, the folder "classes" which is usually a subfolder of WEB-INF does not exist. Instead the "*.class" files are in folder called build in the "first_appli" directory.
I made a simple program : a form.html which calls a servlet

I started by creating the form.html which is the welcome page :

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>	Beer Form </title>
	<h1 align="center">Beer Selection Page</h1>
	<form method="post" action="/servlet">
		Select beer characteristics<p>
		<select name="color" size="1">
			<option value="light"> light </option>
			<option value="amber"> amber </option>
			<option value="brown"> brown </option>
			<option value="dark"> dark </option>
			<input type="submit">

the form calls a servlet :

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

 * Servlet implementation class servlet
public class servlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request,	HttpServletResponse response)throws IOException, ServletException {
		PrintWriter out = response.getWriter();
		out.println("Beer Selection Advice<br>");
		String c = request.getParameter("color");
		out.println("<br>Got beer color " + c);

Finally, I edited the Deployment Descriptor web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="2.5">

The is in the default folder within src folder in the Java_Ressources folder.
Logically, the <servlet-name> tag point to the class file and not the source file ( correct me!!) . Therefore, the fact that the servlet.class is hidden in the build folder surely will matter.

In order to overcome this problem, I tried to create a "classes" subfolder in WEB-INF and put servlet.class in it ==> KO not working

I've put the servlet.class directly in the WEB-INF ==> KO still not working

COULD YOU PLEASE HELP, It's been 2 days since I'm stuck here

thanks in advance
Re: tomcat + dynamic web project [message #697238 is a reply to message #685941] Fri, 15 July 2011 21:28 Go to previous messageGo to next message
Nitin Dahyabhai is currently online Nitin DahyabhaiFriend
Messages: 3177
Registered: July 2009
Senior Member

Get out of the habit of using the default folder/package. Many use cases will outright fail. Put your Servlet class into a package.

As for the discrepancy between the /build and WEB-INF/classes folder, it's handled for you when you launch your application.

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: tomcat + dynamic web project [message #1153103 is a reply to message #697238] Thu, 24 October 2013 11:34 Go to previous message
suvarna deo is currently offline suvarna deoFriend
Messages: 11
Registered: August 2013
Junior Member
Your web.xml file also not correct. for ex is a servlet class.
<servlet-class>com.xx.excel.ReadExcel</servlet-class> // com.xx.excel is a package name.
Previous Topic:Where is wtp-parent Maven project ?
Next Topic:How do overlays in org.eclipse.wst.common.component work
Goto Forum:

Current Time: Fri Jun 22 13:34:41 GMT 2018

Powered by FUDForum. Page generated in 0.01993 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top