0 - clase1 jsp

Upload: ricardo-jauregui-yokokura

Post on 07-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 0 - clase1 jsp

    1/16

    Lic. Jorge Guerra Guerra

  • 8/6/2019 0 - clase1 jsp

    2/16

    A text-based documents capable of

    returning dynamic content to a client

    browser.Contains HTML, XML, programming

    code, and JSP tags(HTML and XML

    tags) allowing access to components

    such as JavaBeans.

  • 8/6/2019 0 - clase1 jsp

    3/16

    Content and display logic are separated.

    Simplify development with JSP, java beans

    and custom tags.

    Supports software reuse through the use ofcomponents.

    Recompile automatically when changes are

    made to the source file.

    Easier to author.

    Platform-independent.

  • 8/6/2019 0 - clase1 jsp

    4/16

  • 8/6/2019 0 - clase1 jsp

    5/16

  • 8/6/2019 0 - clase1 jsp

    6/16

  • 8/6/2019 0 - clase1 jsp

    7/16

    Declarations: define variables and methods.

    Scriptlets JSP code fragments.

    Expressions: results of evaluating the expression are converted toa string.

    Destination:

  • 8/6/2019 0 - clase1 jsp

    8/16

    Used to define variables, methods.Examples:

    Variable declaration:

    x Results in member variables within the compiled servlet.

    Method declaration:x

    The scope of the declaration is in a JSP file. If the JSP file includes other files within the includedirective, the scope expands to cover the includedfiles as well.

  • 8/6/2019 0 - clase1 jsp

    9/16

    Programming code fragments that

    perform tasks beyond the capabilities

    of markup languages (HTML).

    Everything defined in scriptlet goes to

    service() method in JSP servlet.

    Variables declared in scriptlets are localvariables in service() method.

  • 8/6/2019 0 - clase1 jsp

    10/16

    Expressions evaluated during thegeneration of a response. The result is converted into a string, also called the

    output stream. Inserted into the servlet's output. i.e.Results in

    something like out.println(expressions)Syntax

    Semi-colons are not allowed for expressions.

    Expressions are evaluated in a left-to-right order.

  • 8/6/2019 0 - clase1 jsp

    11/16

    Directives are messages to the JSP containerand do not produce output into the currentoutput stream.

    They have a syntax as follows:

    Important directives: page: Communicate page dependent attributes and

    communicate these to the JSP container.x

    include:Used to include text and or code at JSP pagetranslation-time.x

    Taglib: Indicates a tag library that the JSP containershould interpret.

  • 8/6/2019 0 - clase1 jsp

    12/16

    Give high-level information about theservlet that results from the JSP page.

    Control

    Which classes are improted.x What MIME type is generated.x

    How multithreading is handled.x x

    What page handles unexpected errors.x

  • 8/6/2019 0 - clase1 jsp

    13/16

    A JSP page has access to certainimplicit objects that are alwaysavailable, without being declared first.

    They are the following: request(HttpServletRequest)

    response(HttpServletRepsonse).

    session(HttpSession)

    application(ServletContext).

    pageContext, out(of type JspWriter)

    config(ServletConfig), page, exception.

  • 8/6/2019 0 - clase1 jsp

    14/16

  • 8/6/2019 0 - clase1 jsp

    15/16

    Forwards request to HTML page, JSP, or servlet

    Includes output or response from another file

    into this current JSP page.

  • 8/6/2019 0 - clase1 jsp

    16/16