1 of 5

Form Processing

Luca de Alfaro

2 of 5

Typical GET interaction

GET http://www.foo.com/index/3

200 OK + content

Figures out what to respond

3 of 5

Typical POST interaction for a form

POST http://www.foo.com/index/3

+ data (e.g., form dictionary)

303 SEE OTHER /done/4

Does something (e.g., inserts some data)

GET http://www.foo.com/done/4

Produces a page resulting from the add

200 OK + page data

Automatic redirect

4 of 5

Typical interaction for correct form

POST http://www.foo.com/add

+ form data

303 SEE OTHER /index

Produces the form

GET http://www.foo.com/index

200 OK + index page

200 OK + a form to fill in

GET http://www.foo.com/add

Yes, the form is valid. Does something (e.g. adds data)

Returns the index

5 of 5

Typical interaction when form has errors

POST http://www.foo.com/add

+ form data

200 OK + form & error description

Produces the form

200 OK + a form to fill in

GET http://www.foo.com/add

No, the form is not valid. Gives back the semi-filled form + error descriptions.

POST http://www.foo.com/add

+ form data

303 SEE OTHER /index

Yes, the form is valid. Does something (e.g. adds data)