Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
16a WWW WebForms2 f08

16a WWW WebForms2 f08

Ratings: (0)|Views: 26|Likes:
Published by akirank1

More info:

Published by: akirank1 on Jul 02, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





The World Wide Web:Web Applications andWeb Forms, continued
Web Application Programming
Simple HTML is ok for “static pages
When there’s no user input and no processing
But “real”web apps may do many other things
May receive input from users on the client sideMay need to retrieve data from a databaseMay perform computationsThe HTML they return to browsers will changedepending on input and resultsClient side is easy, but restricted
Just use ordinary HTMLOr scripts that run on the client side
e.g., JavaScript or VBscript
What about server side?
FormTags and the Server Side
The heart of most real web apps that accept input isthe HTML Formtag: <form> </form>
Some fields (lots of them):
<input type=“text”/>
Browser renders this tag as a textbox input field
<input type=“submit”/>
Browser renders this as a push buttonWhen clicked, Form is submitted to the Web ServerTextbox input values are also submitted to the ServerIf there’s no method attribute or if form contains a method=“get”tag:»Browser sends an HTTP GET command to server with user inputappended (e.g., user enters 2 & 3 for text fields named op1 & op2):GET /calc.html?op1=2&op2=3 HTTP/1.1If the form has a method=“post”attribute:»Form is submitted with an HTTP POST command with user inputin the body of the HTTP request
When user input from an HTML Form is submittedback to the server, a “postback”has occurred
Look at http://localhost/calc.html
“View| “Source”to see htmlClick “=”& look in browser address bar to see GETpostback data
The Server should respond to the postback byextracting the user input and generating html todisplay the data and the resultsAn important reality: HTML is “stateless”
A page stores no information about its contents from oneinvocation to anotherSo server side code must be running to extract the userinput and generate a new web page that displays thedesired result
and restore the original data if needed and if it is to be visible
Server Response in calc.html Form
Calc Form allows user to enter two numbers to be addedPressing =”button submits numbers to serverOriginal numbers and sum should be returned to browserServer should generatesomething like the following HTML inresponse to user entering 2 and 3 and clicking the “=”button:
<html><body><form><input type="text" name="op1" value="2" />+<input type="text" name="op2" value="3" /><input type="submit" value=" = " />5</form></body></html>
Note: generating repeat input values gives illusion user is seeingone Web page when really we’re seeing two pages in succession
Generating the Server Response
One way:
Use the Common Gateway Interface (CGI)
A low-level programmatic interface between web servers andapplications that run on Web serversA server-side program script that reads inputs, computes, andwrites http responses back to browserUsually written in Perl, but can be done in other languages (C)Hard to use, slow, and has security issuesNot used much any more except on UNIX-based Web servers

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->