Cheatography
https://cheatography.com
Imports in HTML<%@ page import="packageName.Class" %> | <%@ page import="java.text.DecimalFormat" %> | <%@ page import="java.sql.*" %> | <%@ page import="java.util.*" %> | <jsp:include page="date.jsp" flush="true" /> |
Data TypsAll Java Datatyps ( Integer, String, etc. ) | ResultSet rsName; // rsName.getString("Name"); |
Date HandlingDate createTime = new Date(); | "" + date.toString() + "" | <p>Today´s Date: <%= ( new java.util.Date() ) %> </p> |
Function/Methode Deklarationpublic methodName( String methodParameter ) { method Operation } |
| | JSP-Variable Deklaration between HTML<%! String variableName; %> | <%! float functionName(String functionParameter){ function Operation } %> |
JSP-Allocation between HTML
JSP-Output between HTML<form action="<%= request.getRequestURI() %>" method="post"> | <% out.print("<a href='checkbox.jsp'>Zurück</a>"); %> |
Request Operationen: // GET und POSTrequest.getParameter("checkBoxName"); | String [] variableName = request.getParameterValues("checkBoxName"); |
Response Operationen:response.sendRedirect("redirectPageName.jsp"); | response.addCookie( cookie ); |
| | Sessions Deklarationsession.setAttribute("IndexName", "IndexValue"); | session.setMaxInactiveInterval(time); |
Sessions Usagesession.getAttribute("IndexName", object value); | session.getId(); | session.getAttribute(); | session.getAttributeNames(); | session.removeAttribute(); | session.getCreationTime(); | session.getLastAccessedTime(); | session.isNew(); |
EnumarationsEnumeration e = request.getParameterNames();
String name, wert;
while( e.hasMoreElements()) {
name = e.nextElement().toString();
// name = (String) e.nextElement();
wert = request.getParameter(name);
if ( !name.equals("submit") && !wert.equals(""))
out.println(name + ":" + wert + "<br>");
}
|
| | Cookies DeklarationCookie cookie = new Cookie("IndexName", IndexValue);
cookie.setMaxAge(246060); // 24 Stunden
response.addCookie( cookie );
|
Cookie UsageCookie[] cookies = request.getCookies();
for(int i = 0; i < cookies.length; i++){
Cookie c = cookies[i];
if(c.getName().equals("name")){
out.println("Name= " + c.getValue() );
}
}
|
Compare== | != | etc. | user.equals(user_f) |
Comments<!-- comment --> // HTML Comment | <%-- comment --%> // JSP Comment |
Exceptioncatch(Exception e){
e.getMessage();
}
|
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
More Cheat Sheets by Kemmojoo