Skip to content

Instantly share code, notes, and snippets.

@michael-martinez
Last active August 9, 2016 14:50
Show Gist options
  • Save michael-martinez/95dbb5f7ec82cc6b5eaae767128bb257 to your computer and use it in GitHub Desktop.
Save michael-martinez/95dbb5f7ec82cc6b5eaae767128bb257 to your computer and use it in GitHub Desktop.
Memento for Java EE.
Java EE: web services using MVC architecture.
Controller: Application Server (TomCat) + Java code/ EnterpriseJavaBeans
View: JSP pages (compiled as HTML, CSS, XML ... documents)
Model: Server side
Sample View :
<%-- Include Core library --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
<c:out value="${bean}" default="test" />
<c:set target="${bean}" property="prenom" value="${null}" />
<input type="text" name="donnee" value="<c:out value="${donneeSaisieParUnUtilisateur}"/>" />
<c:set var="maVariable" value="11" scope="request" />
<c:set var="maVariable" value="12" />
<c:remove var="maVariable" />
<c:if test="${ 12 > 7 }" var="maVariable" scope="session">
Ce test est vrai.
</c:if>
<c:choose>
<c:when test="${expression}">Action ou texte.</c:when>
<c:otherwise>Autre action ou texte.</c:otherwise>
</c:choose>
<c:forEach var="i" begin="0" end="7" step="1">
<td><c:out value="${i}"/></td>
</c:forEach>
<c:url value="/monSiteWeb/countZeros.jsp">
<c:param name="nbZeros" value="${countZerosBean.nbZeros}"/>
<c:param name="date" value="22/06/2010"/>
</c:url>
<c:redirect url="http://www.siteduzero.com"/>
<c:import url="monDocument.xml" varReader="monReader">
<%-- Parse le contenu du fichier XML monDocument.xml dans une variable nommée 'doc' --%>
<x:parse var="doc" doc="${monReader}" />
<x:out select="$doc/news/article/auteur" />
</c:import>
Sample controler:
HttpSession session = request.getSession();
session.setAttribute( "chaine", "abc" );
String chaine = (String) session.getAttribute( "chaine" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment