Hi I have started doing servlets. I am stuck somewhere. I have installed weblogic server and also configured it. I have also installed the J2EE SDK on my machine. But when I compile my servlet program, it says javax.serlvet.http.* and javax.serlvet.* packages are not found.

Please help me out how to start with doing servlets. Provide me the detailed steps to follow for compiling and running servlets. Here is the code:

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

public class ConfigServlet extends HttpServlet
{	ServletConfig con;
	ServletContext ctx;
	
	public void service(HttpServletRequest req, HttpServletResponse res) throws SevletException, IOException
	{	ctx=getServletContext();
		con=getServletConfig();
		String image=con.getInitParameter("image");		
		String driver=con.getInitParameter("driver");		
		res.setCotentType("text/html")
		PrintWriter out=res.getWriter();
		out.println("<html><body background="+image+">");
		out.println(driver)
		out.println("</body></html>");
	}
}

Classpath, classpath, classpath. Include the jars that contain those packages on your classpath with the -cp option when using javac or added as a library in your project.

can i go and set the classpath variable permanently. if yes, how?
Also please tell me where can i find the jar of these packages.
please tell me for both weblogic and apache tomcat server.

Thanks..

Do not set it permanently! Use your IDE functionality to assign/include only packages you need for given project. Stacking up piles of libraries is pointless. Even better solution would be if you learn how to use Maven and create pom file

if you could please give me the step by step process from installation to configuration to running a servlet.
i am using the weblogic server
thanks

You can find that in the documentation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.