Problem #199
Tags:
web-related
practical
web-development
c-1
c-0
special
After you learned how to create Dynamic Web Page and use Query String Parameters the last cornerstone thing for creating web-applications is to find out how to preserve the state on the server.
Let us regard a simple example - the page which lists employees of a company and allows adding new ones. It should work like following:
name
(e.g. name=John+Doe
) - specified name should be added to the list;kill
is specified, list should be cleared and initialized with single name (the company founder).Here is an example - it also includes small form, so that you can just enter names and click buttons instead of typing parameters manually (but you still can see parameters in the address line). You should see that after adding a name the updated state of the list is preserved for future visitors.
Where to store data on a server?
Most hosting providers will allow you two general options:
MySQL
or MongoDb
are often provided for your applications - however you should
research this on your own (I hope we'll add exercises on SQL later).This exercise allows you to use any of these options. Just make your page accept query parameters name
and kill
-
and make it list employees as described above.
Please make your page list employees using unordered list - i.e. tags ul
and li
, for example:
<ul>
<li>Benjamin Franklin</li>
<li>George Washington</li>
<li>Abraham Lincoln</li>
<li>Theodore Roosevelt</li>
</ul>
We are going to test your list by presense of such list with such tags. Names should follow in the same order they were added.
Input data will contain the name of the founder (person who should appear in a list when it is cleared).
Answer should provide url of your page (without parameters) so our service can test it. Make sure it starts
with http://
(or https://
) prefix.
Example:
input data:
Mr Scrooge
answer:
http://rodiongork.freeshell.org/ca/employees.cgi
The checker will test that given page could respond properly to the following requests:
http://rodiongork.freeshell.org/ca/employees.cgi?name=Random+Words
http://rodiongork.freeshell.org/ca/employees.cgi?kill
etc.