Created
March 30, 2012 14:02
-
-
Save xenda/2251746 to your computer and use it in GitHub Desktop.
Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.upc.sw.servlets; | |
import java.io.IOException; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
/** | |
* Servlet implementation class EcosistemasServlet | |
*/ | |
public class EcosistemasServlet extends HttpServlet { | |
private static final long serialVersionUID = 1L; | |
/** | |
* @see HttpServlet#HttpServlet() | |
*/ | |
public EcosistemasServlet() { | |
super(); | |
// TODO Auto-generated constructor stub | |
} | |
/** | |
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) | |
*/ | |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
doProcess(request, response); | |
} | |
/** | |
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) | |
*/ | |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
doProcess(request, response); | |
} | |
private void doProcess(HttpServletRequest request, | |
HttpServletResponse response) | |
throws ServletException, IOException{ | |
String placa = request.getParameter("placa"); | |
String modelo = request.getParameter("modelo"); | |
PrintWriter out = response.getWriter(); | |
out.println("<body>"); | |
out.println("<h2>Datos Recibidos del Camion</h2>"); | |
out.println("Placa: <strong>"+placa+"</strong>"); | |
out.println("<br />"); | |
out.println("Modelo: <strong>"+modelo+"</strong>"); | |
out.println("</body>"); | |
out.flush(); | |
out.close(); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
get "(.*)" do | |
do_process | |
end | |
post "(.*") do | |
do_process | |
end | |
def do_process | |
placa = params[:placa] | |
modelo = params[:modelo] | |
html =<<TXT | |
<body> | |
<h2>Datos recibidos del camión</h2> | |
Placa: <strong>#{placa}</strong> | |
Modelo: <strong>#{modelo}</strong> | |
</body> | |
TXT | |
html | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment