ColdFusion - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

ColdFusion

Description:

One of the most popular server side tools for ... Login.cfm really just an html page ... body bgcolor=beige cfquery name=testpass datasource='490students' ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 21
Provided by: UST
Category:

less

Transcript and Presenter's Notes

Title: ColdFusion


1
ColdFusion
  • Joe Komar
  • 2001

2
ColdFusion Overview
  • Server side software
  • Uses tags like HTML
  • Has necessary programming structures
  • Provides SQL access to databases
  • One of the most popular server side tools for low
    volume applications

3
Example
  • Simple Student Gradebook
  • Authenticate Instructor
  • Enter Scores for Students
  • Get a Simple Grade Report
  • Following is a subset of the whole system

4
(No Transcript)
5
ColdFusion Pages
  • Login.cfm really just an html page
  • Getcourse.cfm authenticates instructor, sets
    cookie, and presents choices
  • Doit.cfm allows grade entry or produces grade
    report
  • Updatecourses.cfm updates scores entered

6
Login.cfm
lthtmlgt ltbodygt lth3gtEnter your instructor password
herelt/h3gt ltform methodpost actiongetcourse.cfmgt
ltinput namepass typepasswordgt ltinput
typesubmit value"Log in"gt lt/formgt lt/bodygt lt/html
gt
7
Getcourse.cfm
lthtmlgt ltbody bgcolorbeigegt ltcfquery
nametestpass datasource"490students"gt select
password from instructor lt/cfquerygt ltcfset
uppassUCase(form.pass)gt ltcfcookie namepassword
valueuppassgt
8
Getcourse.cfm
ltcfoutput querytestpassgt ltcfif uppass neq
passwordgt ltpgt lth2gtSorry, but wrong password.
Press back and try again.lt/h2gt ltcfelsegt ltform
methodpost actiondoit.cfmgt lth3gtWhich of the
following do you wish to dolt/h3gt lth4gt ltbrgtlti
nput typeradio namechoice value1gtEnter
grades ltbrgtltinput typeradio namechoice
value2gtGet a grade report ltbrgtltbrgt lt/h4gt
ltinput typesubmit value"Submit
Choice"gt lt/formgt lt/cfifgt lt/cfoutputgt lt/bodygt lt/
htmlgt
9
Doit.cfm
lthtmlgt ltbody bgcolorgraygt ltcfquery nametestpass
datasource"490students"gt select password from
instructor lt/cfquerygt ltcfif IsDefined("cookie.pass
word")gt ltcfif cookie.password neq
testpass.passwordgtlt!-- cookie doesn't match
--gt ltpgt lth2gtSorry, but wrong password. Press
back and try again.lt/h2gt
10
Doit.cfm
ltcfelsegt ltcfif form.choice eq "1"gt lth3gtEntering
grades...lt/h3gtltbrgt ltcfquery namegrades
datasource490studentsgt select students.name
as sname, tests.name as tname, stud_tests.
score,tests.points,tests.weight, students.ssn,
stud_tests.number from students,tests,stud_tes
ts where students.ssn stud_tests.ssn
and stud_tests.number tests.number
order by students.name,stud_tests.number lt/cfque
rygt
11
Doit.cfm
ltform methodpost action"updatescores.cfm"gt ltcfs
et count 0gt ltcfoutput querygrades
group"sname"gt lth2gtsnamelt/h2gt ltcfoutputgt
ltinput typehidden namessn valuessngt ltinput
typehidden nametnumber valuenumbergt ltbrgt
tname ltinput typetext namescore
valuescoregt ltcfset count count
1gt lt/cfoutputgt lt/cfoutputgt ltcfoutputgt ltinput
typehidden namecount valuecountgt lt/cfoutput
gt ltbrgtltbrgtltbrgtltinput typesubmit value"Submit
Scores"gt lt/formgt
12
Doit.cfm
ltcfelsegt lth3gtReporting grades...lt/h3gtltbrgt ltcfqu
ery namegrades datasource490studentsgt select
students.name as sname, tests.name as
tname, stud_tests.score,tests.points,tests.weig
ht from students,tests,stud_tests where
students.ssn stud_tests.ssn and
stud_tests.number tests.number order by
students.name,stud_tests.number lt/cfquerygt
13
Doit.cfm
ltcfoutput querygrades group"sname"gt lth2gt
snamelt/h2gt ltcfset total 0gt ltcfset number
0gt ltcfoutputgt ltbrgttname score ltcfset
total total (score weight)gt ltcfset
number number weightgt lt/cfoutputgt ltcfset
average NumberFormat(total / number,
"999.99")gt ltbrgtltstronggtAverage score
averagelt/stronggt lt/cfoutputgt
lt/cfifgt lt/cfifgt
14
Doit.cfm
ltcfelsegtlt!-- NO Cookie --gt lth2gtSorry, but you
have not logged in. Go to lta href"login.cfm"gt he
relt/agt to do so.lt/h2gt lt/cfifgt lt/bodygt lt/htmlgt
15
updatescores.cfm
lthtmlgt ltbodygt ltcfquery nametestpass
datasource"490students"gt select password from
instructor lt/cfquerygt ltcfif IsDefined("cookie.pas
sword")gt ltcfif cookie.password neq
testpass.passwordgtlt!-- cookie doesn't match
--gt ltpgt lth2gtSorry, but wrong password set in
cookie.lt/h2gt
16
Updatescores.cfm
ltcfelsegt ltcfset count 1gt ltcfset cc
form.countgt ltcfloop condition "count le
cc"gt ltcfset ssn GetToken(form.ssn,
count, ",")gt ltcfset tnumber
GetToken(form.tnumber, count, ",")gt ltcfset
score GetToken(form.score, count,
",")gt ltcfquery nameupscores
datasource490studentsgt UPDATE Stud_Tests SET
Score score WHERE SSN 'ssn' AND
Number tnumber lt/cfquerygt
ltcfset count count 1gt lt/cfloopgt
lth2gt All done....lt/h2gt
Press the Back key twice for other
choices. lt/cfifgt
17
Updatescores.cfm
ltcfelsegtlt!-- NO Cookie --gt lth2gtSorry, but you
have not logged in. Go to lta href"login.cfm"gt he
relt/agt to do so.lt/h2gt lt/cfifgt lt/bodygt lt/htmlgt
18
Relational Operators
  • IS (EQUAL, EQ)
  • IS NOT (NOT EQUAL, NEQ)
  • CONTAINS
  • DOES NOT CONTAIN
  • GRATER THAN (GT)
  • LESS THAN (LT)
  • GREATER THAN OR EQUAL (GTE)
  • LESS THAN OR EQUAL (LTE)

19
ColdFusion Components
  • Tags (all start with ltcfgt)
  • Functions common functions for strings,
    numbers, dates, system, etc.
  • Syntax operators, use of pound signs, function
    syntax, etc.

20
Documentation Available
On the server via the Administrator Log on (see
product documentation, CFML Language
Reference) Books and manuals available from the
consultant in room 434 OSS Your instructor Your
fellow students
Write a Comment
User Comments (0)
About PowerShow.com