Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

JSP: Formulaire JSP: comment gérer les valeurs par défaut des paramètres

ut type="submit" value="Submit details" />
    </form>
  </body>
</html>
//displayDetails.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<ht
Comments Off on JSP: Utilisation de tableaux Multidimensionnels

JSP: Utilisation de tableaux Multidimensionnels

<HTML>
  <HEAD>
    <TITLE>Using Multidimensional Arrays</TITLE>
  </HEAD>
  <BODY>
    <H1>Using Multidimensional Arrays</H1>
    <%
        double accounts[][] = new double[2][100];
        accounts[0][3] = 11.09;
        accounts[1][3] = 19.07;
        out.println("Savings Account 3 holds $" + accounts[0][3] + "<BR>");
        out.println("Checking Account 3 holds $" + accounts[1][3]);
     %>
  </BODY>
</HTML>
           
       

JSP: Création d’une classe de gestion d’exception personnalisée

                    value = v;
                }
            }
            void doWork(int value) throws NewException 
            {
                if(value 

JSP: Comment traiter les cookies?

l.value.value}" /><br><br>
</c:forEach>
</c:otherwise>
</c:choose>
</body>
</html>
// cookieSetter.jsp
<jsp:useBean id="cookieBean" class="com.java2s.CookieB

JSP: Exemple de Catch multiple

<HTML>
    <HEAD>
        <TITLE>Catching an ArrayIndexOutOfBoundsException Exception</TITLE>
    </HEAD>
    <BODY>
        <H1>Catching an ArrayIndexOutOfBoundsException Exception</H1>
    <%
    try {
        int array[] = new int[100];
        array[100] = 100;
    } catch (ArrayIndexOutOfBoundsException e) {
        out.println("Array index out of bounds.");
    } catch(ArithmeticException e) {
        out.println("Arithmetic exception: " + e);
    } catch(Exception e) {
        out.println("An error occurred: " + e);
    }
    %>
    </BODY>
</HTML>
           
       

JSP: Comment soummetre un bouton radio

NPUT TYPE="radio" NAME="radios" VALUE="radio3">
             Radio Button 3
            <BR>
            <INPUT TYPE="submit" VALUE="Submit">
        </FORM>
  

JSP: Utlisation de XSLT dans une page JSP

new XSLTInputSource("games.xsl"),
new XSLTResultTarget(bos));
out.println(bos);    
} catch (Exception ex) {
   

JSP: Utilisation de jspInit et jspDestroy

<HTML>
  <HEAD>
    <TITLE>Using jspInit and jspDestroy</TITLE>
  </HEAD>
  <BODY>
    <H1>Using jspInit and jspDestroy</H1>
    <%!
    int number;
    public void jspInit()
    {
      number = 5;
    }
    public void jspDestroy()
    {
      number = 0;
    }
    %>
    <%
    out.println("The number is " + number + "<BR>");
    %>
  </BODY>
</HTML>
           
       

JSP: Informations Locales, Pays, Langue, Fuseaux Horaire, etc

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head><title><fmt:message key="Welcome" bundle="i18n.WelcomeBundle" /></title></head>
<body>
<h2>Here is your Locale info...</h2>
<fmt:message key="Welcome" bundle="i18n.WelcomeBundle" />
<%--  <c:set var="clientLocale" value="${pageContext.request.locale}" />
Locale: <c:out value="${clientLocale.displayName}" />
 <br />
Locale country: <c:out value="${clientLocale.displayCountry}" />
<br />
Locale language: <c:out value="${clientLocale.displayLanguage}" />--%>
</body>
</html>
           
       

JSP: Créer un tableau en jsp

<HTML>
  <HEAD>
    <TITLE>Creating an Array</TITLE>
  </HEAD>
  <BODY>
    <H1>Creating an Array</H1>
    <%
        double accounts[];
        accounts = new double[100];
        accounts[3] = 119.63;
        out.println("Account 3 holds $" + accounts[3]);
     %>
  </BODY>
</HTML>
           
       

JSP: JSP: Verifier si un email est valide

d" value="${chk.password}" scope="request" />
</c:if>
<html>
<head><title>Client Checker</title></head>
<body>
<h2>Welcome</h2>
   
     <strong>Email</strong>:

JSP: Exemple de EL dans les calculs arithmetique*

on</td>
        <td>${'${'}10 - 10 }</td>
        <td>${10 - 10}</td>
      </tr>    
      <tr>
        <td>Multiplication</td>
        <td>${'${'}10 * 10 }</t

JSP: Ajouter une animation Flash dans une page JSP à l’aide de JSTL

wf">
<PARAM name="quality" VALUE="high">
<PARAM name="bgcolor" VALUE="#FFFFFF">
<EMBED SRC=
   "coolFlashMov.swf" quality="high" width="293" height="423" 
  

JSP: Formulaire JSP: insérer des données dans un champ texte

D>
 
//File: index.html
<HTML>
  <HEAD>
    <TITLE>Insertion de texte dans champ de texte</TITLE>
  </HEA>
    <BODY>
        <FORM NAME="form1">
            <INPUT TYPE="TEXT" VALUE="Bienvenu JSP!">
            <INPUT TYPE="SUBMIT" VALUE="Envoyer!">
            

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