你设置虚拟路径吗?
在conf目录下

解决方案 »

  1.   

    代码如下:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;/**
     * This servlet is used to tell the if the Apache JServ installation was
     * successful.
     *
     * @author <a href="mailto:[email protected]">Stefano Mazzocchi</a>
     */public class MyFirstServlet extends HttpServlet {    public static final String TITLE = "Yes, It's working!";    public void service (HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
        {
            // set content type and other response header fields first
            response.setContentType("text/html");        // get the communication channel with the requesting client
            PrintWriter out = response.getWriter();        // get the server identification
            String server = getServletConfig().getServletContext().getServerInfo();        // write the data
            out.println("<html>");
            out.println("<head>");
            out.println("<TITLE>My First Servlet</TITLE>");
            out.println("<meta name=\"GENERATOR\" content=\"Microsoft FrontPage 4.0\">");
            out.println("</head>");
            out.println("<BODY BGCOLOR=\"#1FaFFF\">");
            out.println(" <CENTER>");
            out.println("<p><img src=\"servlets/14.jpg\" width=\"154\" height=\"156\"></p>");
            out.println("</center>");
            out.println("</body>");
            out.println("</html>");    
            
          }
    }
      

  2.   

    你图片的路径放的对不对?可以改img的src属性来试,比如:src="../servlets/14.jpg"