Last change
on this file since 70 was 70, checked in by wouter, 5 years ago |
#31 use jsp because then you keep the same session even without cookies. With html, you get new session every time
|
File size:
970 bytes
|
Rev | Line | |
---|
[70] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
---|
| 2 | <html>
|
---|
| 3 | <head>
|
---|
| 4 | <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
---|
| 5 | <meta content="utf-8" http-equiv="encoding">
|
---|
| 6 | <title>Welcome</title>
|
---|
| 7 | </head>
|
---|
| 8 | <body onload="init()">
|
---|
| 9 | You logged in as :
|
---|
| 10 | <div id="name">-</div>
|
---|
| 11 | <div id="id">-</div>
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | <script>
|
---|
| 15 | "use strict";
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | function init() {
|
---|
| 19 | var xmlHttp = new XMLHttpRequest();
|
---|
| 20 | xmlHttp.open("GET", "AccountServlet", true);
|
---|
| 21 | xmlHttp.onreadystatechange = function() {
|
---|
| 22 | if (xmlHttp.readyState == 4) {
|
---|
| 23 | if (xmlHttp.status == 200) {
|
---|
| 24 | var res=JSON.parse( xmlHttp.responseText );
|
---|
| 25 | document.getElementById('name').innerHTML = res['name'];
|
---|
| 26 | document.getElementById('id').innerHTML = res['id'];
|
---|
| 27 | } else {
|
---|
| 28 | alert("access denied!");
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | xmlHttp.send();
|
---|
| 33 |
|
---|
| 34 | }
|
---|
| 35 | </script>
|
---|
| 36 |
|
---|
| 37 | <noscript>Sorry, your browser does not support JavaScript!</noscript>
|
---|
| 38 | </body>
|
---|
| 39 | </html>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.