1 / 30

CI-2413

CI-2413. CGI & Compañía. mensaje.html. GET /~bsolano/ci2413/mensaje.html HTTP/1.0 Connection: Keep-Alive User-Agent: Mozilla/3.0 (Win95; I) Host: www.ecci.ucr.ac.cr Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*. mensaje.html. FORM action Method Campos INPUT

eara
Download Presentation

CI-2413

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CI-2413 CGI & Compañía

  2. mensaje.html GET /~bsolano/ci2413/mensaje.html HTTP/1.0 Connection: Keep-Alive User-Agent: Mozilla/3.0 (Win95; I) Host: www.ecci.ucr.ac.cr Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

  3. mensaje.html • FORM • action • Method • Campos INPUT • id, name • type

  4. mensaje.php • Recibe el header HTTP: POST /~bsolano/ci2413/mensaje.php HTTP/1.0 Referer: http://www.ecci.ucr.ac.cr/mensaje.html Connection: Keep-Alive User-Agent: Mozilla/3.0 (Win95; I) Host: asgard.ecci.ucr.ac.cr Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* Content-type: application/x-www-form-urlencoded Content-length: 18 mensaje=Hola+Mundo

  5. Server Side Includes • Archivos .shtml <!-- #include virtual = “nombre_archivo” -->

  6. ASP, Active Server Pages ASP es un modelo de objetos para el “Microsoft Internet Information Server”. Con ASP se pueden manipular objetos del servidor y sus propiedades, métodos y eventos que exponen, extendiendo así la operación del servidor. El rendimiento de ASP, la facilidad de desarrollo, y la independencia de lenguaje, lo han convertido en una de las tecnologías más populares para el desarrollo de aplicaciones “Web”.

  7. ASP, Active Server Pages • Modelo de Objetos • Application • Request • Response • Session • Server • ObjectContext

  8. Ejemplo <%@ LANGUAGE=“VBSCRIPT” %> <HTML> <HEAD> <TITLE>ASP Ejemplo</TITLE> <BODY> Buenas tardes.<BR> Bienvenido al ejemplo. Ahora son aproximadamente las <%=Time()%> en el servidor. He aqu&iacute; un par de demostraciones:<BR><BR><BR> Alg&uacute;n formateo de texto simple hecho utilizando HTML:<BR> <FONT size=“1”> Hello Size 1</FONT><BR> <FONT size =“2”> Hello Size 2</FONT><BR> <FONT size =“3”> Hello Size 3</FONT><BR> <FONT size =“4”> Hello Size 4</FONT><BR> <FONT size =“5”> Hello Size 5</FONT><BR> <BR> The same text formatting using server-side code:<BR> <% For intCounter = to 5 %> <FONT size =“<%=intCounter%>”>Hello Size <%=intCounter%></FONT><BR> <% Next %> <BR> </BODY> </HTML>

  9. ASP.NET • ASP.NET es un marco de desarrollo Web que utiliza el Common Language Runtime de Microsoft.

  10. Diferencias entre ASP y ASP.NET • Request • Request.QueryString • Request.Form ASP devuelve una matriz de cadenas ASP.NET devuelve una cadena

  11. Diferencias entre ASP y ASP.NET • Code Behind. • Las páginas ASP.NET sólo admiten un único lenguaje. • La nueva opción predeterminada es el paso de argumentos por valor.

  12. Diferencias entre ASP y ASP.NET • Declarar las funciones de página en bloques <script runat=server>: ASP <% Sub DoSomething() Response.Write "Hello World!" End Sub DoSomething() %> ASP .Net <script language="VB" runat=server> Sub DoSomething() Response.Write ("Hello World!") End Sub </script> <% DoSomething() %>

  13. Diferencias entre ASP y ASP.NET • ASP.NET no admite funciones de procesamiento de páginas: ASP <% Sub RenderSomething() %> <font color="red"> Here is the time: <%=Now %> </font> <% End Sub %> <% RenderSomething RenderSomething %> ASP .Net <script language="VB" runat=server> Sub RenderSomething() Response.Write("<font color=red> ") Response.Write("Here is the time: " & Now) End Sub </script> <% RenderSomething() RenderSomething() %>

  14. Diferencias entre ASP y ASP.NET • Ya no se utilizan las instrucciones Set y Let: ASP <% Dim MyConn Set MyConn = Server.CreateObject("ADODB.Connection") %> ASP .Net <% Dim MyConn MyConn = Server.CreateObject("ADODB.Connection") %>

  15. Diferencias entre ASP y ASP.NET • Ya no existen propiedades predeterminadas no indizadas: ASP <% Set MyConn = Server.CreateObject("ADODB.Connection") MyConn.Open("TestDB") Set RS = MyConn.Execute("Select * from Products") Response.Write RS("Name") %> ASP .Net <% MyConn = Server.CreateObject("ADODB.Connection") MyConn.Open("TestDB") RS = MyConn.Execute("Select * from Products") Response.Write RS("Name").Value %>

  16. JSP

  17. JSP • Razones para utilizar JSP: • Corre en la plataforma JVM • Reutilización de componentes con JavaBeans y EJB • JAVA

  18. JSP, Diferencias con ASP • Son bastante similares. • JSP puede tener una curva de aprendizaje ligeramente mayor. • Ambos permiten código empotrado en HTML, variables de sesión y acceso a bases de datos junto con su manipulación.

  19. JSP, Diferencias con ASP • Sin embargo ASP se encuentra sobre todo en plataformas Microsoft. [Nota: ASP.NET es una norma industrial] • JSP puede operar en cualquier plataforma conforme a la especificación J2EE. • JSP permite reutilización por medio de Javabeans y EJB. ASP provee el uso de controles COM / ActiveX.

  20. JSP, Diferencias con Servlets • Un Servlet es una clase de Java que provee funcionalidad del lado del servidor web. Es difícil escribir código HTML en Servlets. En Servlets se necesitan declaraciones println para generar HTML.

  21. JSP, Diferencias con Servlets

  22. Primer JSP: helloworld.jsp <html> <head> <title>My first JSP page </title> </head> <body> <%@ page language="java" %> <% out.println("Hello World"); %> </body> </html>

  23. JSP: Etiquetas de declaraciones <%! private int counter = 0 ; private String get Account ( int accountNo) ; %>

  24. JSP: Etiquetas de expresiones Date : <%= new java.util.Date() %>

  25. JSP: Etiquetas de directivas • <%@ directive ... %> • Hay tres tipos de directivas: • Página: procesa información para esta página. • Inclusión: incluye archivos. • Biblioteca de etiquetas: biblioteca que se va a utilizar en esta página.

  26. JSP: Etiquetas de Scriptlet <% String username = "ci2413" ; out.println ( username ) ; %>

  27. JSP: Etiquetas de Acción • Hay tres papeles principales para las etiquetas de acción: • Activar el uso de Javabeans en el lado del servidor. • Transferir control entre páginas. • Apoyo independiente del navegador para applets.

  28. JSP: Objetos Implícitos

  29. JSP: Hola Mundo <% String sMensaje = request.getParameter(“mensaje"); out.print(sMensaje); %>

  30. PHP

More Related