Servlets: Exemples d’utiliastion des paramètre des URLs

Author:
       
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ShowFile extends HttpServlet {

  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    ServletOutputStream out = response.getOutputStream();
    // lire le paramètre
    String msg = request.getParameter("message");

    out.println("");
    out.println("");
    out.println("Bienvenu");
    out.println("");
    out.println("");
    out.println("

Voici votre message

");     out.println(msg);     out.println("");     out.println("");     out.close();   }   public void doPost(HttpServletRequest request, HttpServletResponse response)       throws ServletException, IOException {     doGet(request, response);   } }                    

Leave a Reply

Your email address will not be published. Required fields are marked *