javascript
play

Javascript - PowerPoint PPT Presentation

Few elements on HTML, HTTP and Javascript slide 269 Principles of coupling Web/BD slide 293


  1. ������� � Few elements on HTML, HTTP and ����������� �� ���� Javascript �������� ������������ slide 269 � Principles of coupling Web/BD slide 293 � Oracle/Web gateway from INT slide 314 ��� ��� ��������$��$� �������� ������������ � � Allow to define multimedia and distributed hypertexts ��� !�����"��� � Tag Language � structure of document (H1, H2, ...) � presentation (SMALL, B, ...) � Dynamic aspects (SCRIPT, FORM, ...) ��� ��# DB and Web 1

  2. �&����� �� �������$� �'��"(���) < html > � a document can reference another one using < head >< This is a test </ title ></ head > a tag A HREF linking to the the target < body bgcolor="white"> document < h1 >This is a test</ h1 > < hr/ > � < A HREF ="toto.html"> points to the file called This is a list:< p/ > toto.html (we can also used fuly qualified < ul > URL) < li >element 1</ li > � The linked document can be stored on a < li >element 2< /li > </ ul > remote computer </ body > </ html > ��% ��� +,��-����� HTML forms � Uniform Resource Locator � A form allows interactions between client and � UNIQUE and UNIVERSAL address for a file server � Protocol://web-server/path-to-the-file � A form is composed by: � http://www-inf.int-evry.fr/~defude/index.html � Input area with buttons, choice lists, .. ask using http to a server called www-inf.int-evry.fr a file � An action attribute specifying the URL of an located on the root repository of user defude and called index.html executable program on the server � ftp://ftp.int-evry.fr � a method attribute defining the transfer mode for data from the form to the program ��* ��. DB and Web 2

  3. 0�,����$ 1- +����$ Form name < form name ="f1" � a form includes a set of input variables defined using INPUT tags action ="http://www-inf.int-evry.fr/prog.cgi" < input optional url of the CGI type ="hidden" or "submit" program method ="get" name ="name" invocation mode for target ="resultat"> value ="10" CGI variable > name ... default value </ form > optional name of the Target window ��/ ��� 1- +���&������ 0�"� �&����� < html >< body > � < input type ="hidden" name ="title" value ="Scarface"> < form name ="f1" action ="http://www-inf.int-evry.fr/prog.cgi" � attribute called title defined as hidden method ="get" � < input name ="number" value ="10"> target ="result"> � attribute called number which will be displayed Give a value for att1 : < input name ="att1" value ="0"> < input type ="hidden" name ="att2" value =""> � < input type ="submit" value ="run"> < input type ="submit" value ="run"> � Button called run allowing to launch CGI </ form > </ body ></ html > ��� ��� DB and Web 3

  4. !�����"��� !�����"��� �&����� �� �����2%3 < html >< head >< title >QBE QUERY FOR A TABLE</ title ></ head > � Script Language having juste name in common < body bgcolor ='#ddddfa'>< hr > < script language ="Javascript"> with Java! function modif(attribut){ var i; var temp; temp=""; i=0; � Allow to integrate code inside an HTML page if (attribut=="") { which will be processed by the browser (if the return(""); } if (attribut.charAt(0)!='=' &&attribut.charAt(0)!='<' && browser is able to do it or is configure to do it) attribut.charAt(0)!='>' && attribut.charAt(0)!='!'){ attribut='=' + attribut; } � Language includes classical statements from while (attribut.charAt(i)=='=' || attribut.charAt(i)=='<' || attribut.charAt(i) == '>' || attribut.charAt(i) == '!') { programming languages (variables, conditions, temp=temp+attribut.charAt(i); i=i+1; } iterations, functions and procedures, ...) if (attribut.charAt(i)!="'") { temp=temp+"'";} � Some restrictions for security reasons (e.g no while (i < attribut.length ){ temp=temp+attribut.charAt(i); access to the local file system) i=i+1; } if (attribut.charAt(i-1)!="'") { temp=temp+"'" }; return(temp); } ��� ��# !�����"��� �&����� 2*3 !�����"��� �&����� 2�3 < FORM action ="http://www-inf/cgi-bin/bd/prive/multi2.cgi" target ="resultat" function check(form){ method ="GET" var nb; name ="fqbe"> nb=0; < input type ="hidden" name ="uid" value ="citcom/citcom@TANNA"> form.where.value=" where "; < input type ="hidden" name ="mode" value ="NOR"> if (form.NUM.value!=""){ < input type ="hidden" name ="temp" value ="select * from VINS"> if (nb==0) { < input type ="hidden" name ="sqlstatement« value =""> form.where.value+="NUM"+modif(form.NUM.value); < input type ="hidden" name ="where" value =""> else{ form.where.value+=" and "+"NUM"+modif(form.NUM.value); } < table border > nb=nb+1; < caption align ="top">< b >QBE LIKE QUERY FOR A TABLE</ b ></ caption > } < tr >< td >NUM</ td ></ tr > if (nb==0) { < tr >< td ><input name="NUM" size="26"></ td ></ tr > form.where.value=""; </ table > } < input type ="button" value =« query" } onClick ="check(fqbe); </ script > fqbe.sqlstatement.value = fqbe.temp.value+fqbe.where.value; fqbe.submit();"> < input type ="reset" value ="erase"> </ form > </ body ></ html > ��% ��� DB and Web 4

  5. WWW – Basic Architecture WWW - W3 client � Software for hypertext navigation: browser HTTP � interpret and display HTML text � Display flat text without interprétation W3 Client W3 Server � visualise fix images gif, jpeg and x-bitmap � Can be extended by plug-in or external visualisers for specific formats HTML File system HTML page each page � sound, animated image, Postcript, .. has a URL pages ��* ��. WWW - W3 server WWW - HTTP protocol � Functions � HTTP is a simple protocole (GET, EXEC, HEAD, � manage connections from W3 clients ...) � Ensures protection of static documents (HTML, � HTTP is a protocol without session images, ..) � new version HTTP 1.1 allow to maintain a persistent � Checks query validity and access rights for clients connection � Run client queries � HTTP is a protocole with a low level of security � Send back a static document � Run an external program � evolution with S-HTTP (Secure) or SSL (Secure Socket Layer) ��/ ��� DB and Web 5

  6. WWW – document Storage WWW - document Protection � File system from the server � Standard protections from the file system � File tree � Specific protections from the Web to access a document (.htaccess) � By default, from the W3 server with a root directory configured by the administrator � access with a user name and a password � From a user account from the root directory � access from a IP domain ~/public_html � access from a specific computer � A file within the W3 storage space has to be in read mode for all users ��� ��� 451� "�$"�� WWW - Extended Architecture � CGI Interface defines the way data are send from the client to the CGI prog. and back dedicated HTTP CGI � A CGI prog. receives one single argument as protocol CGI W3 client W3 server external appli a large string script � This string can be splitted in a set of attribute- DB or value couples W3 W3 File system File system form page � Two invocation modes GET and POST HTML Pages HTML Pages static dynamic ��� ��# DB and Web 6

Recommend


More recommend