Hello I want to use servlet classes but my servlet classes not available in java. So I have to attach servlet classes into my java and use it, how to ... help me !!
ee bayar wrote:Hello I want to use servlet classes but my servlet classes not available in java. So I have to attach servlet classes into my java and use it, how to ... help me !!
Dear en.bayaraa
What do you mean by "servlet classes not available in java"?
I think bayer means the servlets's .class files are available (in jar or opened) and not the .java files.
If thats the case, you can use them as a jar, just like other API's available in jars. Or even the open .class files, you just need to copy them in your application (at correct location).
hmmm... someplace other than the beginner's forum... maybe servlets?
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
ee bayar
Greenhorn
Joined: Jan 07, 2009
Posts: 3
posted
0
"servlet classes not available in java" this mean in "C:\Program Files\Java\jdk1.6.0_07\src.zip" that in file`s javax folder don`t contain "servlet" folder. When write import javax.servlet.http in my eclipse .... problem !.
So you need Java EE SDK rather than the Java SE JDK.
The Java EE SDK ships with under each Sun Java Application Server (also known as Glassfish) which is a concrete implementation of the Servlet API. The javax.servlet classes are present in its javaee.jar file.
Alternatively (and more recommendable) you can just keep the Java SE and separately download Apache Tomcat which is also a concrete implementation of the Servlet API. The javax.servlet classes are present in its servlet-api.jar file.
Assuming that you're using Eclipse for Java EE (which contains the Web Tools Platform), you can just integrate the application server in it. Go to the servers view, add a new server entry, choose the installed application server (Glassfish or Tomcat or whatever you have installed) and add it. Then you should create a new Dynamic Web Project and associate it with the integrated server. This way Eclipse will take all libraries of the server in the build path (the classpath in Eclipse's terms). Then you should be able to code with the Servlet API!