Why Use Server-Side Scripting?
I've been doing web sites since 1999. The sites I'm currently doing are the following::
- Washington DC Stanford Association - monthly newsletter, membership form,
list of board memberst, etc. (www.stanfordclubs.org/dc)
- Teaching - contain syllabi and handouts for courses I'm currently teaching
and those I've taught in the past (www.billpegram.com)
- ACCA money captain site (in development)
- Holy Trinity - church website (www.htluther.org)
- Sharing Peace - church website (www.sharingpeace.org)
The sites I worked on in the past include (all have undergone substantial change since I worked on them):
- non-profit organization based in Arlington, VA (www.millenniuminstitute.net) - the site has undergone substantial change since I worked on it
- new non-profit organization based in Arlington, VA (www.ourtask.org) - the site has undergone substantial change since I worked on it
- home-based knitting needle business - the site has undergone substantial change since I worked on it
All of these site initially involved only HTML, CSS, and occasionally some
client-side JavaScript. This is typical for small sites. Over time I've added
some server-side scripting to some of the pages. What are the circumstances
under which one might want to add server-side scripting?
- Present content in web page that is already contained in a database
- If the changes to the information are infrequent, e.g. only several
a day, then manually changing the information in the page is feasible,
but requires more labor and runs the risk of inconsistencies between the
web page and the database. Examples would be the www.stanfordclubs.org/dc/listmembers.asp
which lists the current members of the organization. This
information exists in an Access database for other reasons.
- Information entered on a web page will result in various operations - e.g.
changes to a database, creation of invoices, emails to the user. It will often
be cheaper and more error free to do this via server-side scripting rather
than having an employee manually change the database, generate an invoice,
or send an email. An example would be ordering a book from a website reduces
the available inventory of the book, creates an invoice, and sends an email
to the purchaser.
- In the OurTask website, when visitors join via the web, they are automatically
entered into an Access database.
- A change request site I worked on has users input a change request
via a web interface rather than via sending an email.
- For the OurTask organization, I created a two-stage poll using ASP. The poll questions and responses are stored in a database and the questions are presented to user's in a randomized order. The user's responses determine what questions they see in the second round of the poll. The database can be exported to Excel
for statistical analysis.
- For the Stanford club, I recently created an ASP application to compile information
from a group of people. Rather than sending an email asking for people to
respond via email, the email to the people (organizer of each event) sent
them the URL of the web address where they could enter the information and
have it immediately compiled into a single document that was available to
all the contributors of the document. .
- Distributed creation of content for web pages
- With static pages, content has to flow through a webmaster who creates/modifies
the page and uploads it to the server. Some HTML editors (e.g. Macromedia's
Contribute) attempt to allow a number of people to create and upload pages
within a template controlled by the webmaster. With server-side scripting
and access to a database on a server, multiple users can enter information
in a web-based form, that information is then automatically entered into
a database, and that information is then retrieved from the database to
display the page the user sees.
For the Stanford club site, I've done a partial implementation to present
information from an Access database However, I haven't yet added a web interface to put information into the
Access database, and in particular the insertion of links, HTML formatting,
or images may be difficult. There's a web-based tool called Joomla that provides for distributed creation of content.
- A similar example is a discussion board where the contributions of
a number of people are immediately available for everyone to see. (e.g.
www.billpegram.com/discuss/)
- You want to hide scripting code from user (e.g. for proprietary reasons
or to password-protect certain pages)
- Client-side scripting code in page can easily be viewed
- If any external JavaScript files are referenced, the URL of the JavaScript
file can be entered into the location bar of the browser and the external
JavaScript file will be displayed (if the reference is a relative-reference,
the absolute reference can be easily deduced. Absolute references that
begin with a / (what Dreamweaver calls site-root relative references)
just requires the user to determine what the site-root is.
- An example of where this could be useful is where you want to password-protect
certain pages.
- Some things are easier to do with server-side scripting rather than client-side
scripting - e.g. if you want to pass information from a form on one page to
another page, you can do this with client-side scripting, but you have to
use client-side JavaScript string methods on the second page to parse the
information (e.g. from the query string ) whereas ASP provides a method Request.QueryString()
for that purpose.
- Looping capabilities in script as opposed to manual generation - The new
non-profit sent me a draft questionnaire that they want to implement via a
web-based form, with each question calling for a response on the same 5-point
scale (so the same 5 radio buttons for each question). Thus the only thing
that would differ is the question and the name given to each of the radio
buttons in the 5-member group. If the questions were put in a database, then
server-side scripting could loop through, writing out the questions and giving
each group of radio buttons a unique name. If the user's responses are then
sent to the same database, one already has the questions and possible answers
in the database.
Revised: August 12, 2010. Comments to William Pegram, bill@billpegram.com