.Tutoriels Trucsweb
          

 

Niveau : AVANCÉ
Compatibilité : IE / NEtscape

  Ajouter aux favoris  Envoyer à un ami  Version imprimable

Java HTML page generator

with servlet and without JSP

   par Christophe Roux, Franerg (8 Septembre 2001)


Description of JSIP v1.0

In order to fill the need of dynamic HTML page, I developped my own syntax of inclusion in HTML pages ; I called it JSIP as Java Servlet Include Page. The principle of JSIP uses a tag <SERVLET> of SSI Pages in order to indicate the places where to insert content. But JSIP gives the control of the generation of the page to Servlet.

The servlet loads the JSIP page in memory, analyses it to get the servlet tags labeled at the different places in the page. Then each tag labeled is replaced by dynamic content and the page is sent back by the servlet.

This solution is very simple and short but very powerfull and needs no aditional language. You can find Page.java class which implement this algorithm in the JSIP package com.jsip.

 

Here is an example of HTML code for a " Hello world " servlet :



Attempt of JSIP use


Here is a sample of use of a servlet output.



This show the power of JSIP :


Notice the tag . It indicates the place where to include dynamic part from the servlet in the Web page. This tag has an attribute CODE , showing the name of the dynamic part.

 

The servlet HelloWorld, executing the analysis of the HTML page above, could look like this :

import javax.servlet.*;
import java.servlet.http.*;
import com.jsip.* ;

public class HelloWorld extends HttpServlet {
  public void doGet(HttpServletRequest req, HttpServletResponse res)
throws
  ServletException, IOException) {
    PrintWriter out = res.getWriter();
I   Page p = new Page("HelloWorld.html") ;
    p.put("Hello","Hello World !");
    p.put("ByeBye","ByeBye !");
    out.print(p.toString()) ;
  }
}

  • This servlet allows to separate the source code from the HTML page.
  • Notice the compacity of source code both for HTML part and servlet part.
  • tags can be repeated with the same CODE attribute ; the same dynamic content will be added.
  • If all tags are not defined in the servlet, they will be replaced by blank content in the HTML page.
  • JSIP, this elegant solution is provided under the licence haeding the class Page.java.

 

About Christophe Roux

 Début de la page


TrucswebTrucsweb


Fil d'info Trucsweb


 
sp

 
sp
 S U I T E   D U   S U J E T 
sp
Comment générer des pages html en java : sans JSP avec servlet

Hébergement de qualité!

partenaire
Rechercher un tutoriel!
 
 
sp
 C O M M A N D I T E S 
sp






 
sp
 T U T O R I E L S 
sp
· ASP / VBscript
· C/C++
· CSS
· DHTML
· CGI / Perl
· HTML
· Java/JSP
· Javascript
· PHP
· SSI
· WAP/WML
· XML/XSL
· Infographie
· Flash et Shockwave
· Audiovisuel
· Hébergement
· Analyses de logiciels
· Internet et Protocoles
· Veille intégrée
· Référencement
· Sécurité
· Outils gratuits
 
sp
 F O R U M S 
sp
· Forum Javascript
· Forum HTML/CSS
· Forum ASP/VBScript
· Forum Flash
· Tous les forums
 
sp
 S E R V I C E S 
sp
Generateur Trucsweb
· Générateur
· Répertoire
· Logithèque
· Glossaire
· Forum
· Nouveautés Dev Zone
· Ajouter un site
· Ajouter un logiciel
· Ajouter un tutoriel
· Fil d'info sur votre site
· Tester votre site
 
sp
 A P P L I C A T I O N S 
sp
· twCompteur 1.0 Nouveau
· twCalende 1.0 Nouveau
· twLiMenu 1.0 Nouveau
· twValide 2.2 sp
· twAliste 1.0 sp
· twASPDate 2.0 sp
· twASPLivre 1.0 sp
 
sp
 R É F É R E N C E S 
sp
· W3C HTML 4.0
· W3C XHTML 1.0
· Web Design Group
· W3C SMIL 2.0
· W3C XML 1.0
· XML Cover Pages
· W3C CSS LEVEL 2
· Netscape Javascript 1.5
· Netscape Javascript 1.4
· Netscape Javascript 1.3
· Netscape DHTML
· Gecko DOM ref.
· IE DHTML
· VBScript Language Ref.
· JScript Language Ref.
· ASP Object Quick Ref.
· ADO API Reference
· Microsoft IIS5
· MSDN Library
· RFC Editor Site
· HTML 4.0 code de caractères
· Unicode fonts
· Manuel PHP
· Documentation Perl
· Perl 5 Reference Guide
· Flash actionscript FAST
· ActionScript dictionary
· MySQL Manual
· SQL Pro (F. Brouard)
· Java Language Spec.
· Java 2 SDK Doc. V1.3.1
· JavaServer Pages Ref.
· C/C++ Language Ref.
· Python Library Reference
· Les Navigateurs
· Terminologie d'Internet
· Traduction
· Traduction systran
· Traduction d'interface client
· Extensions de fichiers
· Virus Wildlist
· Virus Alerts
 
sp
 D O M A I N E S 
sp
iWeb

iWeb
 
sp
 C O P Y R I G H T  
sp

 

accueil | tutoriels | logithèque | répertoire | forum



© 1997-2006
Django (Oznog) Blais
Rivière-du-Loup, Québec
Ajouter à votre Sidebar  RSS 1.0
 
Conception Oznog co. Multimédia


Hit-Parade    Tout navigateurs   

visiteurs