5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:
性别:秘密
最后登录:2007-04-12
http://Xmercy.5d.cn/
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2005/11/03 | ASP三层架构中的事件处理/表单提交(3)
类别(Develop)
|
评论
(0)
|
阅读(139)
|
发表于 09:46
3.表单数据读取/校验
按上一步骤,表单将转交给下面的实例类处理:
/Action/News.asp
<!--#include virtual="/Class/Package.asp"-->
<!--#include virtual="/Class/Bll/News.asp"-->
<!--#include virtual="/Class/Bll/Admin.asp"-->
<%
Class ActionNews
Private news
private admin
Private Session
Public Property Let NewsID(ByVal value)
news.NewsID = value
End Property
Public Property Get NewsID()
If IsEmpty(news.NewsID) Then
news.NewsID = Request("NewsID")
End If
NewsID = news.NewsID
End Property
Public Property Let ClassID(ByVal value)
news.ClassID = value
End Property
Public Property Get ClassID()
If IsEmpty(news.ClassID) Then
news.ClassID = Request.Form("ClassID")
End If
ClassID = news.ClassID
End Property
Public Property Let Title(ByVal value)
news.Title = value
End Property
Public Property Get Title()
If IsEmpty(news.Title) Then
news.Title = Request.Form("Title")
End If
Title = news.Title
End Property
Public Property Let Content(ByVal value)
news.Content = value
End Property
Public Property Get Content()
If IsEmpty(news.Content) Then
news.Content = Request.Form("Content")
End If
Content = news.Content
End Property
Public Property Let Picture(ByVal value)
news.Picture = value
End Property
Public Property Get Picture()
If IsEmpty(news.Picture) Then
news.Picture = Request.Form("Picture")
End If
Picture = news.Picture
End Property
Public Property Let IsCommend(ByVal value)
news.IsCommend = value
End Property
Public Property Get IsCommend()
If IsEmpty(news.IsCommend) Then
news.IsCommend = (Request.Form("IsCommend") = "1")
End If
IsCommend = news.IsCommend
End Property
Public Property Let Hits(ByVal value)
news.Hits = value
End Property
Public Property Get Hits()
If IsEmpty(news.Hits) Then
news.Hits = Request.Form("Hits")
End If
Hits = Request.Form("Hits")
End Property
Public Property Get NewsIDs()
NewsIDs = Request.Form("NewsIDs")
End Property
Public Property Get Action()
Action = Request.QueryString("actionID")
End Property
Public Function Execute()
admin.CheckLogin()
Select Case Action
Case "insert"
ClassID
Title
Content
Picture
IsCommend
Hits
news.Insert()
Case "edit"
NewsID
ClassID
Title
Content
Picture
IsCommend
Hits
news.Update()
Case "delete"
If NewsIDs <> "" Then
news.BatchDelete(NewsIDs)
Else
NewsID
news.Throw()
news.Delete()
End If
Case Else
Response.Redirect "/"
End Select
news.Throw()
End Function
Private Sub Class_initialize()
Set news = New BllNews
Set admin = New BllAdmin
Set Session = New SessionState
End Sub
Private Sub Class_Terminate()
Set news = Nothing
Set admin = Nothing
Set Session = Nothing
End Sub
End Class
%>
<%
Dim a : Set a = New ActionNews
a.Execute()
Set a = Nothing
%>
0
评论
Comments
日志分类
首页
[66]
Develop
[14]
Plus
[3]
Melody
[7]
Essay
[38]
Archive
[4]