16a_WWW_WebForms2_f09 - The World Wide Web: Web...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
The World Wide Web: Web Applications and Web 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 side – May need to retrieve data from a database – May perform computations – The HTML they return to browsers will change depending on input and results – Client side is easy, but restricted • Just use ordinary HTML • Or scripts that run on the client side – e.g., JavaScript or VBscript – What about server side?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Form Tags and the Server Side • The heart of most real web apps that accept input is the HTML Form tag: <form> … </form> – Some fields (lots of them): <input type=“text” … /> – Browser renders this tag as a textbox input field (like a label control) <input type=“submit” … /> – Browser renders this as a push button – When clicked, Form is submitted to the Web Server – Textbox input values are also submitted to the Server – If there’s no method attribute or if form contains a method=“get” tag: » Browser sends an HTTP GET command to server with user input appended – If the form has a method=“post” attribute: » Form is submitted with an HTTP POST command with user input in the body of the HTTP request Postback – When user input from an HTML Form is submitted back to the server, a “postback” has occurred • Look at http://128.226.119.114/Calc.html – “View” | “Source” to see html – The Server should respond to the postback by extracting the user input and generating html to display the data and the results – An important reality: HTML is “stateless” • A page stores no information about its contents from one invocation to another • So server side code must be running to extract the user input and generate a new web page that displays the desired result – … and restore the original data if needed and if it is to be visible
Background image of page 2
Server Response in calc.html Form – Calc Form allows user to enter two numbers to be added – Pressing “=” button submits numbers to server – Original numbers and sum should be returned to browser – Server should generate something like the following HTML in response 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 seeing one 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 and applications that run on Web servers
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/04/2009 for the course ER CS 360 taught by Professor Reckert during the Spring '09 term at Istanbul Technical University.

Page1 / 11

16a_WWW_WebForms2_f09 - The World Wide Web: Web...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online