{
localOut.println("Hello from JSP!");
}
}
%>
<%
localOut = out;
JSP
Applications Avec Java Server Page(JSP)
JSP: Incorporer Windows media player dans une page JSP
host:8080/home/faithhill_yourestillhere_56-v[1].asx">
java
Formulaire JSP: Utilisation des boutons
INPUT TYPE="BUTTON" VALUE="Button 1" ONCLICK="button1()">
JSP: Utilisation des sessions pour suivre les activités des utilisateurs
Using Sessions to Track Users
Session ID: <%=session.getId()%>
Session creation time: <%=new Date(session.getCrea
JSP: Exemple d’un programme client/server Echo HTTP
edInputStream fromWebServer = null;
private OutputStream toBrowser = null;
private BufferedInputStream fromBrowser = null;
private ServerSocket creat
JSP: Comment utiliser les méthodes surchargé en jsp.
{
public void breathe() throws java.io.IOException
{
localOut.println("Gilling...
");
JSP: Exemple de lecture des données binaires
int numberBytes = fichierinputstream.available();
byte bytearray[] = new byte[numberBytes];
fichierinputstream.read(bytearray)
JSP: Créer et afficher les cookies
ull && name.length()>0) {
added = new Cookie(name,value);
response.addCookie(added);
}
%>
Cookie List
<
JSP: Création d’une page d’erreur
Building a simple error handling page.
<%
try{
int value = 1;
value = value / 0;
}
catch (Exception e){
System.out.println(e.getMessage());
}
%>
JSP: Utilisation des sessions en jsp
<%@ page errorPage="errorpage.jsp" %>
UseSession
<%
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("Hello you have visited this site: "
+ count + " times.");
%>
JSP: Siteweb de conversion de Celsius en Fehrenheit
>
<%
for (int c = 0; c <= 100; c += 10) {
int f = 32 + 9*c/5;
out.print("");
out.print("" + c + " ");
out.p
java
JSP: Utilisation des Boucles dans un Page jsp
th; i++) {
String color = COLORS[i];
%>
;
font-size: 12pt;
font-weight: bold;">
This i
java
JSP et JSTL: Exemple d’utilisation des propriétés get et set de JSTL
////////////////////////////////////////
//Java Bean
package beans;
import java.io.Serializable;
public class CarBean implements Serializable
{
private Str
java
JSP: Créer son propre tag avec des variables script*
ibraryDescriptor">
1.0
1.2
Java2s Simple Tags
java