Page 290 - DCAP408_WEB_PROGRAMMING
P. 290
Web Programming
Notes
Example:
<html>
<head>
<%
sub vbproc(num1,num2)
response.write(num1*num2)
end sub
%>
</head>
<body>
<p>Result: <%call vbproc(3,4)%></p>
</body>
</html>
Show example »
Insert the <%@ language=”language” %> line above the <html> tag to write the procedure/
function in another scripting language:
Example:
<%@ language=”javascript” %>
<html>
<head>
<%
function jsproc(num1,num2)
{
Response.Write(num1*num2)
}
%>
</head>
<body>
<p>Result: <%jsproc(3,4)%></p>
</body>
</html>
13.2 Cookies
One of the challenges of writing applications for the World Wide Web has been inability of the
web to maintain state. That is, after a user sends a request to the server and a web page is
returned, the server forgets all about the user and the page that has been downloaded. If the user
clicks on a link, the server does not have background information about what page the user is
coming from, and more importantly, if the user returns to the page at a later date, there is no
information available to the server about the user’s previous actions on the page.
Maintaining state can be important to developing complex interactive applications. However,
browsers address this problem with cookies, which is a method of storing information locally in
the browser and sending it to the server whenever the appropriate pages are requested by the user.
284 LOVELY PROFESSIONAL UNIVERSITY