Bonjour,
Comment créer et lire des valeurs dans un cookies via forms ?
Est-ce possible ?
Merci
Version imprimable
Bonjour,
Comment créer et lire des valeurs dans un cookies via forms ?
Est-ce possible ?
Merci
Ce n'est pas possible avec les outils de base (pl). C
'est probablement possible avec un petit coup de java, je n'en sais rien.
C'est certainement inutile : comme un utilisateur doit se connecter pour utiliser forms, s'il y a des infos "personnelles" à stocker, autant le faire dans la base.
Sous 9i, j'ai les packages OWA_COOKIE et utl_http qui me semble gèrer les cookies.
Ce sont des pistes, je n'ai jamais utilisé ça.
Avez-vous une tuto sur les owa_cookie ?
Ça serait bien que tu nous donnes un jour la version de bd si tu veux que l'on soi cohérent avec ta bd...
Pour ce qui est d'un tuto, j'ai juste la description du package, qui est souvent suffisante. Sinon je te laisse utiliser google.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 create or replace package OWA_COOKIE is -- These procedures/functions are merely wrappers around -- calls to send an HTTP_COOKIE and to get an HTTP_COOKIE. -- One should be familiar with the specification for -- HTTP cookies before attempting to use these subprograms. -- The HTTP specification for a COOKIE indicates that it -- cookie name/value pairs should not exceed 4k in size. type vc_arr is table of varchar2(4096) index by binary_integer; -- structure for cookies, as you could have multiple values -- associated with a single cookie name. type cookie is RECORD ( name varchar2(4096), vals vc_arr, num_vals integer ); -- Initializes the owa_cookie package variables (called by htp.init) procedure init; -- Calls to the procedure SEND generate an HTTP header line -- of the form: -- Set-Cookie: <name>=<value> expires=<expires> path=<path> -- domain=<domain> [secure] -- Only the name and value are required (as per the HTTP_COOKIE spec), -- and the default is non-secure. -- Calls to SEND must fall in the context of an OWA procedure's -- HTTP header output. For example: -- begin -- owa_util.mime_header('text/html', FALSE); -- -- FALSE indicates not to close the header -- owa_cookie.send('ITEM1','SOCKS'); -- owa_cookie.send('ITEM2','SHOES'); -- owa_util.http_header_close; -- -- -- Now output the page the user will see. -- htp.htmlOpen; -- <etc> procedure send(name in varchar2, value in varchar2, expires in date DEFAULT NULL, path in varchar2 DEFAULT NULL, domain in varchar2 DEFAULT NULL, secure in varchar2 DEFAULT NULL); -- GET will return an OWA_COOKIE.COOKIE structure -- for the specified cookie name. function get(name in varchar2) return cookie; -- REMOVE will simply force the expiration of an existing cookie. -- This call must come within the context of an HTTP header. -- See the definition of SEND above. -- REMOVE generates a line which looks like: -- Set-Cookie: <name>=<value> expires=01-JAN-1990 procedure remove(name in varchar2, val in varchar2, path in varchar2 DEFAULT NULL); -- GET_ALL returns an array of name/value pairs of all HTTP_COOKIES -- sent from the browser. The name/value pairs appear in the order -- that they were sent from the browser. procedure get_all(names out vc_arr, vals out vc_arr, num_vals out integer); end;
voici ma db
Cependant, à la lecture d'owa_cookie les exemples sont utilisés avec des procédure pl/sql pour le DAD.Code:
1
2
3
4
5
6
7
8 select * from v$version Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi PL/SQL Release 10.2.0.2.0 - Production CORE 10.2.0.2.0 Production TNS for Solaris: Version 10.2.0.2.0 - Production NLSRTL Version 10.2.0.2.0 - Production
Moi je suis dans forms donc un applet, le dad c'est de l'html dynamique.
Comment marié les 2 sans pour autant appeler une url pour stocker mon cookie ?
Dans forms, tu utilises bien du PL/SQL ?
oui