[JWS]Adobe WorkFlow 学习笔记(二)

How to Configure the ASP Sample

例子路径:c:\Program Files\Adobe\Form Designer\Samples\HOWTO\Forms\ASPsubmit.xft

There are 4 files that you must copy to the IIS 4.0 Web server in a single folder below the ..\inetpub\ wwwroot\ folder. The user should have at least Read/Write privileges to this folder as a .txt file will be created in this location. The files are located in the Samples\HowTo\Forms\ folder under the folder where you installed Adobe Form Designer. The default is Program Files\Adobe\Form Designer\Samples\HowTo\Forms and are called:
 
     a) ASPsubmit.xft - form template
     b) ASPsubmit.htm - HTML stub
     c) server.asp - gathers form data and redirects it to response.asp
     d) response.asp - presents the form data to the user in a new .ASP page
 
Change the following form object properties on the form template to reflect the user environment:
 
1.  Change the ServerName property and the path to the CGI program in the Copy To Server object on the form (ServerCopy) to reflect the
     new environment.
 
2.  The FileSystemObject requires an account named 'IUSR_machinename' on the remote machine. To create an account, open the User
      Manager on the remote computer and create an account named IUSR machinename (of the Web server) and give that account the same
      password that is used on the IUSR_machinename on the Web server. Use the Internet Service Manager of IIS 4.0 to change the
      authentication method to 'anonymous access'.
 
Modify the server.asp file as follows:
 
1.   Change the variable path in the server.asp file: objTextFile = "c:\inetpub\wwwroot\asp\submdata.txt" to reflect the user's
      environment. In this example, server.asp will create a text file called submdata.txt that contains the form data submitted to the server in
      the 'asp' folder. This folder may have a different name in the user's environment.
 
2.   In the server.asp file, the last line currently reads: Adobe.response.url=http://server/ASP/response.asp. Modify the response
      URL path (where this .asp file will redirect to display the information) to reflect the location of the ASP folder in the new environment.
 
You should not have to change the server.asp or response.asp file. They are programmed to save and display in a new HTML page on the browser, the data submitted by the form.

Submit To Asp Button 的代码

' Before submitting the data to the server, it must be temporarily saved.
' The DefaultDSC is the default datasource object embedded in the form control object.
$Form.DefaultDSC.SaveAsTmp("dat")

'Specify the data that must be sent to the server, here the data saved as temp is sent.
ServerCopy.FileName = $Form.DefaultDSC.DataFile

' Move the file to the web server indicated in the Copy to server object.
ServerCopy.Move()

Server.asp 中的代码

<% @Language="VBScript" %>

<%
' This Sample ASP Page gathers the data from an Adobe form and then
' Redirects the browser to another ASP that will display the user's entries
' DESIGNER: Adobe Form

' Varable Declarations:
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

Dim strEmployeeName 'The employee name entered on the form.
Dim strDepartment 'The Department entered by the user.
Dim strManagerName 'The Manager Name entered by the user.
Dim objfso, objf, objts 'variables for FileSystemObject
Dim sTextFile 'variable to hold the path (on the server) to the text file


sTextFile = Server.MapPath("submitdata.txt")

' Gather the information into variables
strEmployeeName = Request.Form("EmpName")
strDepartment = Request.Form("Department")
strManagerName = Request.Form("ManagerName")

' Create a file on the web server that will store the information

Set objfso = CreateObject("Scripting.FileSystemObject")
objfso.CreateTextFile sTextFile ' Create a file.
Set objf = objfso.GetFile(sTextFile) ' Get the file
Set objts = objf.OpenAsTextStream(ForWriting, TristateUseDefault)


' Write the information on the form to the txt file.

objts.Write "Employee Name: " & strEmployeeName & "
" & "
"
objts.Write "Department: " & strDepartment & "
" & "
"
objts.Write "Manager's Name: " & strManagerName & "
" & "
"

objts.Close

'Specify response URL for copy to server control
Dim sResponsePath
Dim nLoc

sResponsePath = Request.ServerVariables("URL")
nLoc = InStr(1, sResponsePath, "server.asp",1)
sResponsePath = Left(sResponsePath, nLoc - 1) & "response.asp"

Response.Write "Adobe.response.url=http://" & Request.ServerVariables("HTTP_HOST") & sResponsePath

%>

<% @Language="VBScript" %>

<%
' This Sample ASP Page gathers the data from an Adobe form and then
' Redirects the browser to another ASP that will display the user's entries
' DESIGNER: Adobe Form

' Varable Declarations:
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

Dim strEmployeeName 'The employee name entered on the form.
Dim strDepartment 'The Department entered by the user.
Dim strManagerName 'The Manager Name entered by the user.
Dim objfso, objf, objts 'variables for FileSystemObject
Dim sTextFile 'variable to hold the path (on the server) to the text file


sTextFile = Server.MapPath("submitdata.txt")

' Gather the information into variables
strEmployeeName = Request.Form("EmpName")
strDepartment = Request.Form("Department")
strManagerName = Request.Form("ManagerName")

' Create a file on the web server that will store the information

Set objfso = CreateObject("Scripting.FileSystemObject")
objfso.CreateTextFile sTextFile ' Create a file.
Set objf = objfso.GetFile(sTextFile) ' Get the file
Set objts = objf.OpenAsTextStream(ForWriting, TristateUseDefault)


' Write the information on the form to the txt file.

objts.Write "Employee Name: " & strEmployeeName & "
" & "
"
objts.Write "Department: " & strDepartment & "
" & "
"
objts.Write "Manager's Name: " & strManagerName & "
" & "
"

objts.Close

'Specify response URL for copy to server control
Dim sResponsePath
Dim nLoc

sResponsePath = Request.ServerVariables("URL")
nLoc = InStr(1, sResponsePath, "server.asp",1)
sResponsePath = Left(sResponsePath, nLoc - 1) & "response.asp"

Response.Write "Adobe.response.url=http://" & Request.ServerVariables("HTTP_HOST") & sResponsePath

%>

总结:
如何通过Form向Asp发送数据呢?

1.在Form中添加ServerCopy控件
2.修改ServerCopy的普通属性中的值
    HTTP
         ServerName = SERVERNAME
         CGIProgram = /ASP/server.asp
 

原文地址:https://www.cnblogs.com/xuzhong/p/383877.html