0

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>");
	}
}
3
Contributors
7
Replies
9
Views
6 Years
Discussion Span
Last Post by amitbhanot
0

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.

0

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..

Edited by amitbhanot: n/a

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.