コード例 #1
3
 public void service(HttpServletRequest req, HttpServletResponse res) {
   try {
     res.setContentType("text/html");
     PrintWriter out = res.getWriter();
     out.println("<html><body>");
     ServletContext ctx = getServletContext();
     String name = (String) ctx.getAttribute("con");
     out.println("name= " + name);
     out.println("</html></body>");
   } catch (Exception e) {
   }
 }
コード例 #2
2
 @Override
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   response.setContentType("text/html");
   PrintWriter out = response.getWriter();
   String title = "Test Servlet with Utilities";
   out.println(
       ServletUtilities.headWithTitle(title)
           + "<body bgcolor=\"#fdf5e6\">\n"
           + "<h1>"
           + title
           + "</h1>\n"
           + "<p>Simple servlet for testing.</p>\n"
           + "</body></html>");
 }
コード例 #3
0
ファイル: HelloClient.java プロジェクト: dracohan/ideaproject
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   response.setContentType("text/html"); // must come first
   PrintWriter out = response.getWriter();
   out.println(
       "<html><head><title>Hello Client!</title></head><body>"
           + "<h1>Hello Client!</h1>"
           + "</body></html>");
 }
コード例 #4
0
ファイル: EbayServlet.java プロジェクト: Zeroe31890/unihub
  @Override
  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    String keywords = (req.getParameter("search")).replace(" ", "%20");
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " + "Transitional//EN\">\n";
    String myAppId = "MarkWill-00a1-4cb0-b23d-5d85d0c939f1";

    out.println(
        "<html>\n"
            + "<body>\n"
            + "The eBay response should be here: "
            + "<a href=http://open.api.ebay.com/shopping?callname=FindHalfItems&appid="
            + myAppId
            + "&version=527&QueryKeywords="
            + keywords
            + "&responseencoding=SOAP>Here is an XML response from eBay"
            + "</a>\n"
            + "</body>\n"
            + "</html>\n");
  }