¡GoConqr estrena diseño! Cuéntanos qué te parece.

Mapa mental

Java Web

Jorge Celis Español

Java Web

Contenido del mapa

Java Web

  1. web application

    • deployable unit of content and configuration
  2. deployment

    • 2 ways
      • copying files
      • deploy war
  3. Servlet

    • must implement servlet interface
      • protocol agnostic (can use others tha HTTP)
    • Generic servlet class
      • HttpServlet class
        • contains
          • a request obj
          • a response obj
          • service method
          • 4 http methods
            • get response object as param
              • response can redirect
              • return string
              • return component
            • get request as param
              • get headers, parameter, body for POST etc
          • init method
    • servlet mapping(rounting)
      • notation @WebServlet("/home")
        • also can use @WebServlet(urlPatterns = {"", "*.something"})
      • mapping info held in web.xml
        • define 2 sections
          • servlet
            • creates a servlet and associated to a class
          • servlet mapping
            • bind an URL or URL patter to an existing servlet
      • try not to mix both approches
    • Initialization
      • override init method from generic servlet
        • use annotation
          • initParams = {@WebInitParam (name="", value="")}
        • override in web.xml
          • define values in xml, and bind in init()
    • ServletContext
      • container context app wide scope
        • all servlet in container have access
        • in order to used
          • define in web.xml a "context-param" tag
    • RequestDispatcher
      • a servlet catch request
        • then use request dispatcher to send it into other Servlet or JSP
      • Accessible from Servlet Context
        • RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/index.jsp")
          • use 1 of 3 methods available to pass beans
            • dispatchet.forward(request, response)
  4. Java Server Pages

    • contain multiple lenguages
      • HTML
        • to define component
      • java
        • to define behavior
        • wrap it inside <% ... %>
    • is compiled
      • into a servlet(index_jsp.java)
        • extend HttpJspBase which
          • extends HttpServlet
        • here, HTML is replaced by its java counterpart
      • page translation time
        • when JSP is translated into java
          • and java is compiled into class file
    • life cycle (same as servlet)
      • init()
      • Destroy
      • Service
    • directives
      • include
        • <%@include file="" %>
          • used as a reference to add a splitted html fragment
      • <%@page..."%>
        • to modify page behavior
          • <%@page autoFlush="" "%>
          • <%@page errorPage="" "%>
          • <%@page buffer="8kb" "%>
          • <%@page isErrorPage="true" "%>
            • give us access to exception element
              • <%= exception.getMessage() %> and more error info avai.
      • define behavior on run time of the page
    • handling exception
      • define in web.xml an <error-page> specifing the JSP path
        • throw new exception
    • implicit objects
      • request
      • response
      • objects created by the web container for each jsp page
  5. MVC

    • Model = POJO or Beans
      • May contain logic or just data
      • should be stored in a context to access it
        • globally so any JSP can access it
          • getServletContext().setAttribute(name, object);
        • inside a session so only an specific user has access
          • request.getSession.setAttribute("user", user)
        • passed through Request Dispatcher
          • request.setAttribute("user", user)
      • properties accessibility
        • dot object.property
        • [] : object["property"]
    • Controller = Servlet or Listeners
    • View = JSP
  6. expression language

    • language simpler than java tag
      • used inside html tag
        • ${user.name}
      • could be used to replace java code tags
    • not need to specify scope
      • it look in all scopes for the object
        • can use this technique to assing dinamically styles
      • has access to implicit objects
    • operators
      • mathematical
      • logical
      • empty
        • validate the value of a var
  7. Java Standard Tag Library

    • provide encapsulation of UI logic
    • set of standard tags used in JSP
      • individual tags are java classes
      • tag metadata held in Tag Library Descriptor file
      • wrapped inside a JAR
    • in order to use it, need to import the tag core
      • <% taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
        • then can use it throug: <c::tag_name value="" >
    • core tag
      • conditional tags
      • formatting tags
      • SQL tags
    • can use Exp language to validate conditions

Imágenes y archivos del mapa

  • Java Web
  • Java Web

Información

Descripción
Mapa Mental sobre Java Web, creado por Jorge Celis el 25/09/2019.
Creado por
Jorge Celis
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?