apuntes:introduccion
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
apuntes:introduccion [2017/09/21 00:01] – [Lenguajes y tecnologías para programación web en entorno servidor] Santiago Faci | apuntes:introduccion [2019/02/13 17:16] (current) – [Herramientas para el desarrollo web en entorno servidor] Santiago Faci | ||
---|---|---|---|
Line 96: | Line 96: | ||
{{ lamp.jpg }} | {{ lamp.jpg }} | ||
< | < | ||
+ | |||
+ | El lenguaje //PHP// fue diseñado por //Rasmus Lerdorf// y ahora se mantiene por una comunidad de desarrolladores, | ||
+ | |||
+ | A continuación, | ||
+ | |||
+ | <code php> | ||
+ | . . . | ||
+ | . . . | ||
+ | <div id=" | ||
+ | <table class=" | ||
+ | <thead class=" | ||
+ | <tr class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </tr> | ||
+ | </ | ||
+ | <tbody class=" | ||
+ | <?php | ||
+ | |||
+ | $resultado = $bbdd-> | ||
+ | " | ||
+ | |||
+ | if ($resultado-> | ||
+ | echo "< | ||
+ | } | ||
+ | else { | ||
+ | | ||
+ | while ($fila = $resultado-> | ||
+ | |||
+ | echo "< | ||
+ | echo "< | ||
+ | echo "< | ||
+ | echo "< | ||
+ | if ($fila[" | ||
+ | echo "< | ||
+ | else | ||
+ | echo "< | ||
+ | echo "< | ||
+ | echo "< | ||
+ | echo "< | ||
+ | echo "< | ||
+ | echo "< | ||
+ | echo "</ | ||
+ | } | ||
+ | |||
+ | $resultado-> | ||
+ | } | ||
+ | ?> | ||
+ | . . . | ||
+ | . . . | ||
+ | </ | ||
=== JSP / Servlets === | === JSP / Servlets === | ||
- | ((http:// | + | [[http:// |
- | ((http:// | + | Por otra parte, [[http:// |
+ | |||
+ | Ambas son tecnologías desarrolladas por //Sun Microsystems// | ||
< | < | ||
{{ jsp.gif }} | {{ jsp.gif }} | ||
< | < | ||
+ | |||
+ | Ejemplo de página web dinámica creada con JSP: | ||
+ | |||
+ | <code html> | ||
+ | <div class=" | ||
+ | <div class=" | ||
+ | < | ||
+ | </ | ||
+ | <div class=" | ||
+ | <table class=" | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | < | ||
+ | <% | ||
+ | Repository repo = new PhoneRepository(); | ||
+ | List< | ||
+ | int count = 1; | ||
+ | for (Phone phone : phonesList) { | ||
+ | %> | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | . . . | ||
+ | . . . | ||
+ | <div class=" | ||
+ | <form class=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | <label for=" | ||
+ | <input type=" | ||
+ | < | ||
+ | <input type=" | ||
+ | <button class=" | ||
+ | </ | ||
+ | </ | ||
+ | . . . | ||
+ | . . . | ||
+ | </ | ||
+ | |||
+ | Ejemplo de Java Servlet, correspondiente al mismo proyecto que la página JSP anterior: | ||
+ | |||
+ | <code java> | ||
+ | @WebServlet(name = " | ||
+ | public class PhoneActions extends HttpServlet { | ||
+ | |||
+ | private final static Logger LOGGER = | ||
+ | Logger.getLogger(PhoneActions.class.getCanonicalName()); | ||
+ | |||
+ | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, | ||
+ | |||
+ | String action = request.getParameter(" | ||
+ | Repository repo = new PhoneRepository(); | ||
+ | |||
+ | switch(action) { | ||
+ | case " | ||
+ | repo.insert(new Phone(request.getParameter(" | ||
+ | Phone.IMAGE, | ||
+ | request.getParameter(" | ||
+ | response.sendRedirect(" | ||
+ | break; | ||
+ | case " | ||
+ | repo.delete(request.getParameter(" | ||
+ | response.sendRedirect(request.getHeader(" | ||
+ | break; | ||
+ | default: | ||
+ | break; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </ | ||
=== Python === | === Python === | ||
((http:// | ((http:// | ||
+ | |||
+ | El lenguaje //Python// fue diseñado por //Guido van Rossum// y ahora se mantiene gracias a una comunidad de desarrolladores, | ||
< | < | ||
{{ django_apache.png }} | {{ django_apache.png }} | ||
< | < | ||
+ | |||
+ | Ejemplo de código escrito con Python. En este caso utilizando el framework //Django// para el desarrollo de aplicaciones web: | ||
+ | |||
+ | En este caso, al tratarse de un framework MVC, tendremos la vista: | ||
+ | |||
+ | <code python> | ||
+ | < | ||
+ | {% if lista_peliculas %} | ||
+ | < | ||
+ | {% for pelicula in lista_peliculas %} | ||
+ | < | ||
+ | {% endfor %} | ||
+ | </ul> | ||
+ | {% else %} | ||
+ | < | ||
+ | {% endif %} | ||
+ | </ | ||
+ | |||
+ | Separada del controlador: | ||
+ | |||
+ | <code python> | ||
+ | from django.shortcuts import render | ||
+ | |||
+ | . . . | ||
+ | |||
+ | def index(request): | ||
+ | lista_peliculas = Pelicula.objects.all() | ||
+ | context = {' | ||
+ | return render(request, | ||
+ | </ | ||
=== ASP.NET === | === ASP.NET === | ||
- | ((https:// | + | [[https:// |
+ | |||
+ | Al funcionar sobre la plataforma //.NET// de Microsoft, permite que se pueda desarrollar en cualquier de los lenguajes de programación de dicha plataforma, //Visual Basic .NET// o //C#//. | ||
+ | |||
+ | Lo más habitual es verlo funcionar junto con el servidor web de Microsoft, IIS (Internet Information Server). | ||
< | < | ||
{{ asp_iis.png }} | {{ asp_iis.png }} | ||
< | < | ||
- | ==== Herramientas para el desarrollo web en entorno servidor ==== | ||
- | ---- | + | A continuación, |
- | ===== Ejercicios ===== | + | <code csharp> |
+ | protected void Button1_Click(object sender, EventArgs e) | ||
+ | { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
- | ---- | + | <code html> |
+ | <%@ Page Language=" | ||
+ | | ||
- | ===== Proyectos de Ejemplo ===== | + | < |
- | ---- | + | <html xmlns=" |
- | ===== Prácticas | + | < |
+ | < | ||
+ | | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | <form id=" | ||
+ | < | ||
+ | |||
+ | < | ||
+ | </ | ||
+ | |||
+ | <br /> | ||
+ | <br /> | ||
+ | |||
+ | < | ||
+ | <hr /> | ||
+ | |||
+ | <h3> Results: </ | ||
+ | <span runat=" | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
---- | ---- | ||
- | (c) 2017 Santiago Faci | + | (c) 2017-2019 Santiago Faci |
apuntes/introduccion.txt · Last modified: 2019/02/13 17:16 by Santiago Faci