读书人

怎么在Eclipse中编写JSP文件

发布时间: 2012-01-10 21:26:50 作者: rapoo

如何在Eclipse中编写JSP文件?
请问怎样在Eclipse中导入servlet.jar文件阿~~~
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import

public class ExampleServlet extends HttpServlet{
public void doGet( HttpServletRequest request, HttpServletResponse response ){
try
{
PrintWriter out = response.getWriter();
String output;
//Instruct the servlet to respond with html
response.setContentType( "text/html " );
output = " <html> <body> <head> <title> Example Servlet </title> </head> Hello World </body> </html> ";
//Print the response to the Web browser.
out.println( output );
//Close the Printwriter object
out.close();
}
catch( Exception e)
{
//Print any exceptions to the system console.
System.err.println( e.toString() );
}
}
}

在import javax....那里就是有错,好郁闷阿~~~

[解决办法]
工程属性-> java build path-> libraries-> add External jar

读书人网 >Eclipse开发

热点推荐