Jsp

From no name for this wiki
Revision as of 10:54, 5 September 2009 by Claude (talk | contribs) (Implizite EL Objekte)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Elemente in JSPs

scriplets

<% int x = 5; %>

expressions

<%= x %>

directives

<%@ page language="java" %>

XML

<jsp:directive.page pageDirectiveAttrList />

actions

<jsp:forward page="/servlet/login" />

declarations

<%! x = 4;>

EL Expressions

 ${haha}

Implizite Objekte in Scriptlets, JSP 2.0

  • page java.lang.Object, class implementiert Servlet im Servlet Fall.
  • out javax.servlet.jsp.JspWriter
  • config javax.servlet.ServletConfig
  • request javax.servlet.http.HttpServletRequest
  • response javax.servlet.http.HttpServletResponse
  • session javax.servlet.http.HttpSession
  • pageContext javax.servlet.jsp.PageContext
  • application javax.servlet.ServletContext
  • exception Throwable

Importierte Namespaces in Jsps

  • java.lang.*
  • javax.servlet.*
  • javax.servlet.jsp.*
  • javax.servlet.http.*

Methoden in JSP Servlets

Interface HttpJspPage

  • jspInit()
  • jspDestroy()
  • _jspService(), kann nicht ueberschrieben werden
  • getParameter()

EL Operators

  • &&
  • +
  • *
  • -
  •  %
  • ||
  •  !
  • div
  • mod
  • or
  • and
  • not
  • ==
  • eq
  • ne
  • <
  • lt
  • >
  • gt
  • <=
  • ge
  • >=
  • le
  • empty
  • A ? B : C

EL reserved words

  • and
  • eq
  • gt
  • true
  • instanceof
  • or
  • ne
  • le
  • false
  • empty
  • not
  • lt
  • ge
  • null
  • div
  • mod

Implizite EL Objekte

  • pageContext (pageContext.servletContext, pageContext.session, pageContext.request, pageContext.response)
  • param
  • paramValues
  • header
  • headerValues
  • cookie
  • initParam
  • pageScope
  • requestScope
  • sessionScope
  • applicationScope

Tag return values

doStartTag()

  • Tag.EVAL_BODY_INCLUDE
  • BodyTag.EVAL_BODY_BUFFERED
  • SKIP_BODY

doEndTag()

  • SKIP_BODY
  • EVAL_PAGE

Reihenfolge der Listeners

Session-Attributes

1. HttpSessionBindingListener 2. HttpSessionAttributeListener

Resourcen