Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Télécharger la bibliothèque BasicCircuits-0.83.jar

Télécharger la bibliothèque BasicCircuits-0.83.jar
public abstract String getKeyIdentifier()
public abstract int getKeyLocation()
public abstract boolean getCtrlKey()
public abstract boolean getShiftKey()
Comments Off on JSP: Afficher HTML en JSP

JSP: Afficher HTML en JSP

<%@ page session="false" %>
<%
   out.println("<code>out</code> is an <i>");
   out.println(out.getClass().getName());
   out.println("</i> object.");
%>
           
       

JSP: Affichage de l’en-tête du requête et les attribues de la session

   // Print the request headers
   map = new TreeMap();
   enames = request.getHeaderNames();
   while (enames.hasMoreElements()) {
      String name = (String

Télécharger la bibliothèque BasicCircuits-0.91display.jar

Télécharger la bibliothèque BasicCircuits-0.91display.jar
public abstract String getKeyIdentifier()
public abstract int getKeyLocation()
public abstract boolean getCtrlKey()
public abstract boolean getShiftKey()

JSP: Utilisation de la classe Calendar avec un Bean

ASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitat

JSP: Modifier les Attributs de PageContext d’une page JSP

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%
  synchronized (pageContext) {
    Class thisClass = getClass();
  // session.setAttribute("thisClass", thisClass);
    pageContext.setAttribute("thisClass", thisClass, PageContext.PAGE_SCOPE);
    System.out.println("Stored reference");
    Class theClass = (Class) pageContext.getAttribute("thisClass", PageContext.PAGE_SCOPE);
    System.out.println("The retrieved reference is " + theClass);
  }
%>
<html>
  <body>
    The class that instantiated this JSP is <c:out value="${pageScope.thisClass.name}" />.
  </body>
</html>
           
       

JSP: Afficher les Propriétés du système

ellpadding="3" cellspacing="0">
<%
   final String[] propNames = {
      "java.awt.printerjob",
      "java.class.path",
      "java.class.version",
      "java

JSP: Utilisation des sessions pour suivre les activités des utilisateurs

        <H1>Using Sessions to Track Users</H1>
        Session ID: <%=session.getId()%>
        <BR>
        Session creation time: <%=new Date(session.getCrea

JSP: Créer et afficher les cookies

ull && name.length()>0) {
    added = new Cookie(name,value);
    response.addCookie(added);
  }
%>
<HTML>
  <HEAD>
    <TITLE>Cookie List</TITLE>
  </HEAD>
  <

JSP: Utilisation des sessions en jsp

<%@ page errorPage="errorpage.jsp" %>
<html>
  <head>
    <title>UseSession</title>
  </head>
  <body>
    <%
      Integer count = (Integer)session.getAttribute("COUNT");
      // If COUNT is not found, create it and add it to the session
      if ( count == null ) {
      
        count = new Integer(1);
        session.setAttribute("COUNT", count);
      }
      else {
        count = new Integer(count.intValue() + 1);
        session.setAttribute("COUNT", count);
      }  
      out.println("<b>Hello you have visited this site: "
        + count + " times.</b>");
    %>
  </body>
</html>
           
       

JSP: Siteweb de conversion de Celsius en Fehrenheit

>
<%
   for (int c = 0; c <= 100; c += 10) {
      int f = 32 + 9*c/5;
      out.print("<tr>");
      out.print("<td align="right">" + c + "</td>");
      out.p

Télécharger la bibliothèque baselet_mailapi.jar

Télécharger la bibliothèque baselet_mailapi.jar
public abstract String getKeyIdentifier()
public abstract int getKeyLocation()
public abstract boolean getCtrlKey()
public abstract boolean getShiftKey()

JSP: Afficher l’heure Actuelle en jsp

<%--
  Copyright (c) 2002 by Phil Hanna
  All rights reserved.
  
  You may study, use, modify, and distribute this
  software for any purpose provided that this
  copyright notice appears in all copies.
  
  This software is provided without warranty
  either expressed or implied.
--%>
<%@ page import="java.text.*,java.util.*" session="false"%>
<%!
   DateFormat fmt = new SimpleDateFormat("hh:mm:ss aa");
   String now = fmt.format(new Date());
%>
The time is <%= now %>
           
       

JSP: Réécriture des paramètre des sessions

>
  <%@ page import="java.util.*" %>
<%
  String nom = request.getParameter("name");
  String valeur = request.getParameter("value");
  if (name!=null && value!=null && name.length()>0) {
    // Ajouter des paramètre à une Session JSP
    session.setAttribute(nom,valeur);
  }
Comments Off on JSP Session: Exemple d’ajout des produits dans un panier

JSP Session: Exemple d’ajout des produits dans un panier

SIS,
 <jsp:useBean id="cart" scope="session" class="sessions.DummyCart" />
<jsp:setProperty name="cart" property="*" />
<%
  cart.processRequest(request);
%>
<FONT size = 5 COLOR="#CC0000">
<br> You have the following items in your cart:
<ol>
<% 
  String[] items = cart.getItems();
  for (int i=0; i<items.length; i++) {
%>
<li> <% out.print(util.HTMLFilter.filter(items[i])); %> 
<%
  }