Setting Up a Web Application

marlinlineInternet και Εφαρμογές Web

31 Οκτ 2013 (πριν από 3 χρόνια και 7 μήνες)

71 εμφανίσεις

Setting Up a Web Application

This chapter describes how to configure your system to build web applications in
Macromedia Dreamweaver MX 2004.

This chapter contains the following sections:



What you need to build web applications




Setting up a web

server




Setting up an application server




Creating a root folder for the application




Defining a Dreamweaver
site




Connecting to a database


What you need to build web
applications

To build web applications in Dreamweaver, you nee
d the following software:



A web server (see
Setting up a web server
)



An application server that works with your web serv
er (see
Setting up an
application server
)

Note:
In the context of web applications, the terms
web server
and
application
server

refer to software, not

hardware.

If you want to use a database with your application, you need the following additional
software:



A database system



A database driver that supports your database

For information on setting up a database for your we
b application, see
Connecting to
a database
.

Several web hosting companies offer plans that let you use their software to
test and
deploy web applications. In some cases, you can install the required software on the
same computer as Dreamweaver for development purposes. You can also install the
software on a network computer (typically a Windows 2000 or XP computer) so that
o
ther developers on your team can work on a

project.

Choosing your application server

The application server you choose depends on several factors, including your budget,
the server technology you want to use (ColdFusion, ASP.NET, ASP, JSP, or PHP),
and you
r choice of web

server.

Budget

Some vendors sell high
-
end application servers that are expensive to buy and
administer. Others vendors provide easier, more cost
-
effective solutions (examples
include Macromedia ColdFusion and JRun servers). Some application

servers are
built into web servers (such as Microsoft IIS) and others can be downloaded for free
from the Internet (such as Jakarta Tomcat and PHP).

Server technology

Application servers use different technologies. Dreamweaver
supports five server technol
ogies: ColdFusion, ASP.NET, ASP, JSP, and PHP. For
more information, see "Choosing a server technology" in Getting Started Help. The
following table shows common application servers available for the five server
technologies supported by Dreamweaver:

Serv
er technology

Application server

ColdFusion

Macromedia ColdFusion MX

ASP.NET

Microsoft IIS 6 with .NET Framework

ASP

Microsoft IIS or PWS

Sun ONE Active Server Pages

JSP

Macromedia JRun

Sun ONE Application Server

IBM WebSphere

Apache Tomcat

BEA WebLo
gic

PHP

PHP server

Web server

Your choice of application server can also depend on the web server you
want to use. Make sure the application works with your web server. For example, the
.NET Framework only works with IIS 5 or higher.

Installing an ASP.NE
T application
server

To run ASP.NET pages, you need the following software:



A Windows 2000 or Windows XP Professional computer running IIS 5 or
later



The Microsoft .NET Framework, which you can download from the Microsoft
website

Download the .NET Framew
ork from the Microsoft website at
http://asp.net/download.aspx

and follow the installation instructions on the website.

It is highly recommended that you also install the Microsoft Data Access Com
ponents
(MDAC) 2.7 package after installing the .NET Framework. You can download and
install the MDAC 2.7 package for free from the Microsoft website at
www.microsoft.com/data/downloa
d.htm
.

Macintosh or Windows 98 users can use a web hosting service with an ASP.NET plan
or install the .NET Framework on a remote Windows 2000 or Windows XP
Professional computer running IIS 5 or later.

After installing the .NET Framework, create a root f
older for your web application.
See
Creating a root folder for the application
.

-----------------------------------



Crea
ting a root folder for the application

After signing up with a web hosting company or setting up the server software
yourself, create a root folder for your web application on the computer running the web
server.

Make sure the folder is published by the w
eb server
--
in other words, the web server
can serve any file in this folder or in any of its subfolders in response to an HTTP
request from a web browser. For example, on a computer running ColdFusion MX, any
file in the
\
CFusionMX
\
wwwroot folder or any of

its subfolders can be served to a web
browser.

The following are the default root folders of selected web servers:

Web server

Default root folder

ColdFusion MX

\
CFusionMX
\
wwwroot

IIS or PWS

\
Inetpub
\
wwwroot

Apache (Windows)

\
apache
\
htdocs

Apache (Mac
intosh)

Users:MyUserName:Sites

Jakarta Tomcat (Windows)

\
jakarta
-
tomcat
-
4.x.x
\
webapps
\
ROOT
\

To test the web server, place a test HTML page in the default root folder and attempt to
open it by entering the page’s URL in a browser. The URL comprises the do
main
name, such as www.mysite.com, and the filename of the HTML page, as follows:

www.mysite.com/testpage.htm

If the web server is running on your local computer, you can use
localhost

instead of a
domain name. Using the previous example, enter the followi
ng localhost URL
depending on your web

server:

Web server

Localhost URL

ColdFusion MX

http://localhost:8500/testpage.htm

IIS or PWS

http://localhost/testpage.htm

Apache (Windows)

http://localhost:80/testpage.htm

Apache (Macintosh)

http://localhost/~My
UserName/testpage.htm (where

MyUserName is your
Macintosh user name)

Jakarta Tomcat
http://localhost:8080/testpage.htm

(Windows)

Note:
By default the ColdFusion MX web server runs on port 8500 and the Jarkarta
Tomcat web server runs on port 8080.

If the

page doesn’t open as expected, check for the following errors:



The web server is not started. Consult the web server’s documentation for
starting instructions.



The file does not have an .htm or .html extension.



You entered the page’s file path (for exa
mple,
c:
\
CFusionMX
\
wwwroot
\
testpage.htm), not its URL (for example,
http://localhost:8500/testpage.htm), in the browser’s Address text box.



The URL contains a typing mistake. Check for errors and make sure the
filename is not followed by a slash, such as
http://localhost:8080/testpage.htm/.

After creating a root folder for your application, define a Dreamweaver site to manage
your files. See
Defining a Dreamweaver site
.



--------------------------------

Installing a PHP application server

To run PHP pages, you need the PHP application server, which is open
-
source
software available on the web. Editions of the application se
rver exist for Windows,
Linux, UNIX, HP
-
UX, Solaris, and Mac OS X systems. The application server works
with the following web servers: Apache, Microsoft IIS or PWS, Netscape and Sun
ONE servers, and almost all web servers that support the CGI interface.

Y
ou can download the PHP application server from the PHP website at
www.php.net/downloads.php
. For information on installing the server, see the PHP
documentation, which you can also download f
rom the PHP website at
www.php.net/download
-
docs.php
.

If you’re a Macintosh user, you can use the PHP application server installed with your
operating system. For more information, see the

following websites:



www.macromedia.com/go/php_macintosh/




http://developer.apple.com/internet/macosx/php.html


After installing the PHP application server, create a root folder for your web
application. See
Creating a root folder for the application
.

Installing a PHP application server

To run PHP pages, you need the PHP application server, which is open
-
source
software available on the w
eb. Editions of the application server exist for Windows,
Linux, UNIX, HP
-
UX, Solaris, and Mac OS X systems. The application server works
with the following web servers: Apache, Microsoft IIS or PWS, Netscape and Sun
ONE servers, and almost all web servers

that support the CGI interface.

You can download the PHP application server from the PHP website at
www.php.net/downloads.php
. For information on installing the server, see the PHP
documentat
ion, which you can also download from the PHP website at
www.php.net/download
-
docs.php
.

If you’re a Macintosh user, you can use the PHP application server installed with your
operating sys
tem. For more information, see the following websites:



www.macromedia.com/go/php_macintosh/




http://developer.apple.com/internet/macosx/php.html


After installing the PHP application server, create a root folder for your web
application. See
Creating a root folder for the application
.

*******************************************************************

*************************************
******************************

Defining a Dreamweaver site

After configuring your system to develop web applications, define a Dreamweaver
site to manage

your files.

Before you start, make sure you meet the following requirements:



You have access to a web
server. The web server can be running on your local
computer, on a remote computer such as a development server, or on a server
maintained by a web hosting company. See
Setting up a web server
.



An application server is installed and running on the system running your web
server. See
Setting up an application server
.



You created a root folder for your web application on the system running your
web server. For more information, see
Creating a root folder for the
application
.

Defining a Dreamweaver site for your web application consists of three steps:

1.

Define a folder located on your hard disk as a Dreamweaver loca
l folder to
store working copies of your site files (see
Defining a local folder
).

2.

Define a folder located on the compute
r running your web server as a
Dreamweaver remote folder (see
Defining a remote folder
).

3.

Specify where Dreamweaver should

send dynamic pages to be processed
while you work (see

Specifying where dynamic pages can be processed
).

After the Dream
weaver site is defined, you can start building your web application.

Defining a local folder

You can define a Dreamweaver local folder for each new web application you create.
The local folder is the folder

you use to store working copies of site files on

your hard
disk. Defining a local folder also gives you the ability to manage your files and to
transfer files to and from your web server at the click of a button.

To define a Dreamweaver local folder:

1.

Create a folder on your local disk to store working
copies of your files.

You may want to create subfolders to store image files and other assets.

2.

In Dreamweaver, select Site > Manage Sites, click the New button on the
Manage Sites dialog box, and select Site from the context menu.

The Site Definition dia
log box appears.

3.

If the wizard is showing, click Advanced; then select Local Info from the
Category list (it

should

be the default).

4.

In the Site Name text box, enter a descriptive name for your Dreamweaver
site.

5.

In the Local Root Folder text box, specify

the folder you created in Step 1.

You can enter a path, or click the folder icon to browse to and select the
folder.

6.

If you want, complete the other options in the Local Info category (they are
not required to

make the site work).

For more information o
n these options, see
Setting Local Info category
options
.

Leave the Site Definition dialog box open. You must specify a r
emote folder next. See
Defining a remote folder
.

Defining a remote folder

After defining a local folder, you can define a
remote folder for your Dreamweaver
site. The remote folder is the folder you created for your web application on the web
server (see
Creating a root folder for the application
).

You don’t need to define a remote folder if the folder you defined in
Defining a local
folder

can double as the root folder for your web application. (This implies that the
web server is running on your local computer.)

To define a Dreamweaver remote folder:

1.

If the Site Definition dialog box is not open, open it by sele
cting Site >
Manage Sites, selecting your site from the list in the Manage Sites dialog box,
and clicking Edit.

The Site Definition dialog box appears.

2.

If the wizard is showing, click Advanced and select Remote Info from the
Category list.

The Remote Inf
o dialog box appears.

3.

In the Access pop
-
up menu, select one of the following options:
Local/Network, FTP, or RDS.

Your choice tells Dreamweaver how you want to transfer files between your
local folder and remote folder.

Note:
To use RDS, the remote folder

must be on a computer running
ColdFusion.

You can also send your files to a SourceSafe application by selecting
SourceSafe Database. (SourceSafe is used by developers for file version
control.) If you select this option, you need to define a separate fold
er. For
instructions, see
Specifying where dynamic pages can be processed
.

4.

After selecting an access method, set the acces
s options as appropriate.

For more information, see
Setting Remote Info category options
.

Leave the Site Definition dial
og box open. You need to define a folder to process
dynamic pages

next. See
Specifying where dynamic pages can be processed
.

Specifying where dynamic pages can be
processed

After defining the remote folder in Dreamweaver, specify a folder where dynamic
pages can be processed. Dreamweaver uses this folder to generate dynamic content
and connect to databases while you work.

Typ
ically, you specify the root folder you created on the web server (see
Creating a
root folder for the application
) because

the server probably also runs an application
server that can handle the dynamic pages.

Note:
The root folder can be local or remote, depending on where your web server is
running.

To specify where Dreamweaver can get dynamic pages processed:

1.

If the Site

Definition dialog box is not open, open it by selecting Site >
Manage Sites, selecting your site from the list in the Manage Sites dialog box,
and clicking Edit.

The Site Definition dialog box appears.

2.

If the wizard is showing, click Advanced and select
Testing Server from the
Category list.

The Testing Server dialog box appears. Dreamweaver needs the services of a
testing server to generate and display dynamic content while you work. The
testing server can be your local computer, a development server, a

staging
server, or a production server. As long as it can process the kind of dynamic
pages you plan to develop, the choice doesn’t matter.

3.

Complete the dialog box and click OK.

For more information, see
Setting the Testing Server category options
.

After defining a Dreamweaver site, you can connect to a database. (See
Creating a
root folder for the application
.)

Related topics



Setting the URL prefix




*******************************************************************


Connecting to a database

If you want to use a database with your web application, you must first connect to it.
For a general discussion of da
tabase connections, see
Understanding database
connections
.

Dreamweaver handles database connections differently depending

on your choice of
server technology. See the following chapters:



Database Connections for ColdFusion

Developers




Database Connections for ASP.NET Developers




Database Connections for ASP Developers




Database Connections for JSP Deve
lopers




Database Connections for PHP Developers



*******************************************************************

Dat
abase Connections for ASP.NET
Developers

To use a database with an ASP.NET application, you need to create a database
connection in

Macromedia Dreamweaver MX 2004. This chapter describes how to
create the database

connection.

Note:
If you’re developing Mi
crosoft Active Server Pages (ASP) applications, see
Database Connections for ASP Developers
.

The chapter assumes you have
set up an ASP.NET application (see
Setting Up a Web
Application
). It also assumes a database is set up on your local compu
ter or on a
system to which you have network or FTP access.

This chapter contains the following sections:



Connecting to a
database




Editing or deleting a database connection


To connect to the sample database provided by Dreamweaver, see "Setu
p for Sample
ASP.NET Site" in Getting Started Help. To learn more about databases and database
connections, see
Beginner’s
Guide to Databases
.

------------------------------------------------------------------------------------

Understandi ng database connections

If you plan to use a database with your web application, you need to create at least one
database connection. With
out one, the application won’t know where to find the
database or how to connect to it. You create a database connection in Dreamweaver by
providing the information
--
or the "parameters"
--
the application needs to establish
contact with the database.

Note:
Y
ou don’t need to create database connections for ColdFusion pages in
Dreamweaver. You connect using ColdFusion data sources defined in ColdFusion
Administrator.

This section discusses database connections in general terms. For specific instructions
on crea
ting connections in Dreamweaver, see
Connecting to a database
.


----------------------------------------------------------
--------------------------

Connecting to a database

This section describes how to connect to a database when developing an ASP.NET
application in

Dreamweaver.

Before you can connect to a database, you must obtain an OLE DB provider for your
database. If yo
u want to connect to a Microsoft SQL Server database, you can use the
Managed Data Provider for SQL Server that is supplied by the .NET Framework. For
more information, see
Obtaining an OLE DB provider for your database
.

Once the database provider is installed, you can use it to connect to the database. For
instructions, see the following sections:



Creating an ASP.NET database connection in Dreamweaver




Creating a connection using Data Link Properties


Related topics



Sample OLE DB co
nnection parameters for ASP.NET


Obtaining an OLE DB provider for
your database

An ASP.NET application must connect to a database through an OLE DB provider.
The provider acts as an interpreter that lets an ASP.NET application communicate
with a database.

For more information on OLE DB and the role of database providers,
see
Communicating with the database
.

If you want to c
onnect to a Microsoft SQL Server database, you can use the Managed
Data Provider for SQL Server that comes with the .NET Framework. This provider,
which is optimized for SQL Server and is very fast, is installed when you install the
.NET Framework.

If you
want to connect to a database other than SQL Server, make sure an OLE DB
provider for your database is installed on the computer running the .NET Framework.
You can obtain an OLE DB provider for Microsoft Access by downloading and
installing the Microsoft
Data Access Components (MDAC) 2.7 package from the
Microsoft website at
www.microsoft.com/data/download.htm
.

You can download OLE DB providers for Oracle databases from the Oracle we
bsite
at
http://otn.oracle.com/software/tech/windows/ole_db/content.html

(registration is
required). You can also purchase OLE DB providers from third
-
party vend
ors.

Once you have a provider for your database, you can use it to create database
connections in

Dreamweaver. See
Creating

an ASP.NET database connection in
Dreamweaver
.

Creating an ASP.NET database
connection in Dreamweaver

After obtaining an OLE DB provider for your database (see
Obtaining an OLE DB
provider for your database
), you can use it to create a database connection in
Dreamweaver.

Another option is to use the Microsoft Data Link Properties dialog box to help you
create the connectio
n. For instructions, see
Creating a connection using Data Link
Properties
.

To create a database connection for ASP.NET:

1.

Op
en an ASP.NET page in Dreamweaver, then open the Databases panel
(Window

>

Databases).

The panel displays the connections defined for the site.

2.

Click the Plus (+) button on the panel and select OLE DB Connection or SQL
Server Connection from the pop
-
up me
nu.

Note:
Select SQL Server Connection only if you want to connect to a
Microsoft SQL Server

database.

The OLE DB Connection or SQL Server Connection dialog box appears.

3.

Complete the dialog box and click OK.

For more information, see the following:

o

Setting the OLE DB Connection dialog box options


o

Setting the SQL Server Connection dialog box options


The new connection appears in the Databases panel.

Related topics



Troubleshooting Database Connections


Creating a connection using Data Link
Properties

After obtaining an OLE DB provider for your database (see
Obtaining an OLE DB
provider for your database
), you can create a database connection by using the Data
Link Properties dialog box in Windows.

Important: You can use this metho
d only if the OLE DB provider you want to use is
installed on the same Windows computer as Dreamweaver.

To create a database connection using Data Link Properties:

1.

Open an ASP.NET page in Dreamweaver, then open the Databases panel
(Window

>

Databases).

Th
e panel displays the connections defined for the site.

2.

Click the Plus (+) button on the panel and select OLE DB Connection from
the pop
-
up menu.

The OLE DB Connection dialog box appears.

3.

Click the Build button.

The Data Link Properties dialog box appears
. This Windows dialog box
displays the OLE DB providers currently on the Windows computer running
Dreamweaver.

4.

Complete the Data Link Properties dialog box and click OK.

Dreamweaver inserts a connection string in the OLE DB Connection dialog
box.

5.

Click T
est.

Dreamweaver attempts to connect to the database. If the connection fails,
double
-
check the connection string. If the connection still fails, check the
settings for the folder Dreamweaver uses to process dynamic pages (see
Specifying where dynamic pages can be processed
).

6.

Click OK.

The new connection appears in the Databases panel.

Related topics



Troubleshooting Database Connections


Sample OLE DB connection parameters
for ASP.NET

An OLE DB connection string combines all the information yo
ur ASP.NET
application needs to connect to a database. Dreamweaver inserts this string in your
page’s server
-
side scripts for later processing by your application server.

Dreamweaver provides you with string templates to create OLE DB connection
strings fo
r ASP.NET applications (see
Creating an ASP.NET database connection in
Dreamweaver
). To create a connection string, you re
place placeholders in the
template with the requested parameter values. This section gives sample parameters
for Microsoft Access and SQL Server databases.

Note:
For the parameter values specific to other databases, see the database vendor’s
documentation
or consult your system administrator.

Case 1:

You have the .NET Framework on your local computer and you want to
connect to a Microsoft Access database called sdSchool.mdb located in the following
folder on your hard disk: c:
\
Inetpub
\
wwwroot
\
SkyDiveSchool
\
data
\
sdSchool.mdb.
Here are the parameters to create this connection string:

Provider=Microsoft.Jet.OLEDB.4.0;

Data Source=c:
\
Inetpub
\
wwwroot
\
SkyDiveSchool
\
data
\
sdSchool.mdb;

Case 2:

You use the .NET Framework on a remote development server and you want
to

connect to a Microsoft Access database called mtnSchool.mdb located on the
server in the following folder:
d:
\
users
\
tara
\
projects
\
MtnDrivingSchool
\
data
\
mtnSchool.mdb. Here are the
parameters to create the connection string:

Provider=Microsoft.Jet.OLEDB.4.
0;

Data
Source=d:
\
users
\
tara
\
projects
\
MtnDrivingSchool
\
data
\
mtnSchool.mdb;

Case 3:

You use the .NET Framework on a networked development server called
Savant and you want to connect to a Microsoft SQL Server database called pubs on
the server. Your SQL Ser
ver user name is "sa" and there is no password. If you use
the Managed Data Provider for SQL Server (that is, if you chose SQL Connection in
the Databases panel), here are the parameters to create the connection string:

Data Source=Savant;

Initial Catalog=
pubs;

User ID=sa;

Password=;

Editing or deleting a database
connection

When you create a database connection, Dreamweaver stores the connection
information in an include file in the Connections subfolder in the site’s local root
folder. You can edit or del
ete the connection information in the file manually or as
follows.

To delete a connection:

1.

Open an ASP.NET page in Dreamweaver, then open the Databases panel
(Window

>

Databases).

A list of connections appears in the panel.

2.

Right
-
click (Windows) or Cont
rol
-
click (Macintosh) the connection and select
Delete Connection from the pop
-
up menu.

The dialog box you used to create the connection appears.

3.

Confirm that you want to delete the connection.

Note:
To avoid getting errors after deleting a connection, u
pdate every
DataSet that uses the old connection by double
-
clicking the name of the
DataSet in the Bindings panel and selecting a new connection in the DataSet
dialog box.


*******************************************************************

Database Conne
ctions for PHP
Developers

To use a database with a PHP application, you need to create a database connection
in

Macromedia Dreamweaver MX 2004. This chapter describes how to create the
database

connection.

For PHP development, Dreamweaver only supports the

MySQL database system.
Other database systems such as Microsoft Access or Oracle are not supported.
MySQL is open
-
source software you can download for free from the Internet for non
-
commercial use. For more information, see the MySQL website at
www.mysql.com/downloads/mysql.html
.

The chapter assumes you have set up a PHP application (see
Setting Up a Web
Application
). It also assumes a MySQL database is set up on your local computer or
on a system to which you have network or FTP access.

This chapter contains the following sections:



Connecting to a database




Editing or deleting a database connection


To connect to the sample database provided by Dreamweaver, see "Setup for Sample
PHP Site" in Getting Started Help. To learn more about databases and database
connections, see
Beginner’s Guide to Databases
.