This is a draft cheat sheet. It is a work in progress and is not finished yet.
Tags
Embed code (Scriptlet) |
<% %> |
Expression (print) |
<%= %> |
Directive |
<%@ %> |
Declaration |
<%! %> |
Directives
Library import |
<%@ page import=“java.libreria.algo” %> |
Scriplet Language |
<%@ page language=“java” %> |
Content type generated by the page |
<%@ page contentType="text/html; charset=ISO-8859-1“ %> |
Page codification |
<%@ page pageEncoding="ISO-8859-1" %> |
Include a file |
<%@ include file="file.jsp" %> |
|
|
Out
Clears current content of the buffer |
clearBuffer() |
Flush the stream |
fflush() |
Returns the size of the budder used by the JspWriter |
getBufferSize() |
Returns the number of unused bytes in the buffer |
getRemaining() |
Indicates wheter the JspWriter is autoflushing |
isAutoFlush() |
Prints the argument |
print("...") |
Prints and terminate the line |
println("...") |
Null pointer exception if null |
write("...") |
Request
any extra path information associated with the URL the client sent when it made this request. localhost:8080/Arquitectura3Capas |
getPathInfo() |
Extra path information after the servlet name but before the query string |
getPathTranslated() |
Query string conatined in the request URL afther the path |
getQueryString() |
Portion of the URI that indicates the context of the request. /Arquitectura3Capas |
getContextPath() |
/Arquitectura3Capas/ |
getRequestURI() |
http://localhost:8080/Arquitectura3Capas/ |
getRequestURL() |
Enumeration of all the header names this request contains |
getHeaderNames() |
Value of the specified request header as an Enumeration of String objects |
getHeader(String name) |
Value of the specified request header as a long that represents a Date object |
getDateHeader(String name) |
Name of HTTP method made. GET, POST, PUT |
getMethod() |
Array containing all of the cookie Objects |
getCookies() |
Session ID specified by the cliente |
getRequestedSessionId() |
Current session associated with this request, if doesn't exist, creates one |
getSession() |
Checks whether the session si valid |
isRequestedSessionIdValid() |
Login of the user making this request, null if not authenticated |
getRemoteUser() |
Datos de la peticion hecha por el navegador
Response
Adds the specified cookie to the response |
addCookie(Cookie cookie) |
Adds a response header with the given name and value |
addHeader(String name, String value) |
Adds a response header with the given name and integer value |
addIntHeader(String name, int value) |
Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed, returns the URL unchanged |
encodeRedirectURL(String url) |
Sends a temporary redirect response to the client using the specified redirect location URL |
sendRedirect(String location) |
Sends an error response to the client using the specified status code and clearing the buffer |
sendError(int sc) |
Sends an error response to the client using the specified status |
sendError(int sc, String msg) |
Cookies --> Redirect! Necesita refresco de la pagina
Cookie c = new Cookie()
response.addCockie(c)
|
|
|