
<%
dim s
s=request("number")
if s="" then
%>
<html>
<head>
<title>
请输入口令
</title>
</head>
<body>
<form>
<input type="text" name="number">
<input type="submit" name="b" value="确定">
</form>
</body>
</html>
<%
responseend
elseif s="4321" then
responsewrite "欢迎进入!!"
responseend
else
responsewrite "对不起,口令输入错误,请重新输入"
end if
%>
<html>
<head>
<title>
请输入口令
</title>
</head>
<body>
<form>
<input type="text" name="number">
<input type="submit" name="b" value="确定">
</form>
</body>
</html>
JVPL和mvc设计模式类似 一个变种的MVC设计模式 下面我们将详细介绍JVPL模式以及JVPL设计模式的demo实例 第一部分 另类的MVC架构JVPL架构
(JVPL模式的系统结构图)
JVPL模式(JSON+视图+处理器+加载器)
)定义:
JVPL和mvc设计模式类似 一个变种的MVC设计模式
)MVC的优弱点:
MVC让开发从原来的 webform中解脱出来 解决了层次清晰逻辑与UI的隔离以及服务端控件的一些瑕疵等诸多问题 但是MVC的弱点同时也存在 在MVC中我们的Model时常变动 我们必须手动创建Model类和Model的变动修改 同时对于 Model的Action控制 *** 作也需要一定程度上的变动 (由实体框架等生成的实体(Model)是无法满足现行逻辑需求的)
其次因为实际开发中没有银d 只有平衡点 V C之间的逻辑紧密 然而实际的前台实现和效果需求是变化莫测的 更加导致美工决定VC的局面 从而VC的重用性很低很低 如果一个页面存在多个视图 那么其逻辑就相对不易(我们需要维护多个VC组 我们需要处理VC组的一定逻辑次序 构造不同的Model)
)JVPL设计模式的优势
)JVPL(json 视图 处理器 加载器) 如上图所示 如果我要视图重用我只要载入所需视图和加载器即可 var 新的视图=get( 加载器 视图 ); 且架构会接着脚本引擎帮助我们生成后台所需代码
)整个JVPL模式建立建立在Ajax的机制上 它具有Ajax所有的优缺点 (但我认为Ajax的优点>>缺点 且我们可以通过手段解决这些缺点) 正如有人说Ajax不安全 因为暴露了系统服务接口 这完全废话 难道纯的form提交就没有暴露这些都是门外汉说的话 因为根本的权限机制都没有建立 接着说 正如前面文章提到的视图数据的加载 如果我前台的逻辑变动系统的逻辑变动 这是Moon Web会辅助我们生产新的后台代码 如果一个页面存在多个视图 那么这多个视图的加载 我们通过加载器直接调度即可 因为脚本引擎的存在 它会帮助我们生成后台代码和数据分配及数据转发 Moon NET中最为精华的部分就是脚本引擎 它也是我们提高开发效率的关键
)在我们的开发中 前端展现的标准是由策划及美工定的 所以作为一个开发者还是架构师必须紧密结合实际进行架构或开发 这样才能提高开发效率 Moon Web主要对复杂的UI控件诸如:编辑器 分页 异步文件上传 等控件进行了封装且提供了美工可控制接口 因为MVC的控件方法也是一样的
JVPL设计模式的demo实例
说明:JVPL设计模式与传统的ASP NET开发完全兼容 且符合MVC的设计理念
实例一:程序配置
配置文件设置
<appSettings> <add key= DLL value= Web dll /> >数据处理器和数据加载器所在的类库名(放在Bin里面) <add key= dbType value= PostgreSql /> >数据库的类型 <add key= linkString value= Server=localhost;Database=MoonDB;User ID=postgres;Password=mingyue; /> >连接字符串 <add key= ;
// 库文件引用
引用Moon Orm和Moon Web库
// 加入脚本库到根目录
// 页面开发
结构
<%@ Page Language= C# AutoEventWireup= true CodeBehind= WebForm aspx cs Inherits= Web WebForm %> <!DOCTYPE PUBLIC //W C//DTD XHTML Transitional//EN transitional dtd > < xmlns= > <head> <title>model加载和数据更新</title> <meta equiv= content type content= text/; charset=utf /> <script type= text/javascript src= Scripts/jquery min js ></script> <script type= text/javascript src= Scripts/Qin Engine js ></script <script> var pID= ; $(function () { Qin_LoadDataToDom ( Web UserInfoAction GetUserInfo {} form_UserInfo function(data){ alert(data A); pID=data A; }); }); function AjaxUpdateUserInfo() { var ID =pID; _TableName= PersonSet ; Qin_AjaxUpdate( Web UserInfoAction AjaxUpdateUserInfo form_UserInfo ID ID { } function (data) { alert( 主键为 +data+ update success ); }); } </script> </head> <body> <form id= form_UserInfo > <input id= keyID class= Key field= ID type= hidden /> <table style= width: %; > <tr> <td> 姓名: </td> <td> <input field= UserName type= text /> </td> </tr> <tr> <td> 性别 </td> <td> <input name= Sex field= Sex value= true type= radio />男<input name= Sex field= Sex value= false type= radio />女 </td> </tr> <tr> <td> 年龄 </td> <td> <input field= Age type= text /> </td> </tr> <tr> <td> 北京户口 </td> <td> <input field= IsBeiJing type= checkbox /> </td> </tr> <tr> <td> 年龄段 </td> <td> <select field= AgePeriod ><option value= >老年人</option><option value= >中年人</option><option value= >年轻人</option></select> </td> </tr> </table> <input type= button onclick= AjaxUpdateUserInfo(); value= 更新用户数据 /> </form> </body> </>
两处**部分 表示的数据的加载和数据提交
[Log()]//加载的代码 public static void GetUserInfo() { PersonSet data= DBFactory GetEntity<PersonSet>(PersonSetTable ID Equal( )); CustomData cus=new CustomData(); cus A= ; ReturnJSONString(data cus); }
[Log()]//更新部分的代码(代码生成器会自动生成) public static void AjaxUpdateUserInfo() { PersonSet data=new PersonSet(); string UserName=Request[ UserName ]; string Sex=Request[ Sex ]; string Age=Request[ Age ]; string IsBeiJing=Request[ IsBeiJing ]; string AgePeriod=Request[ AgePeriod ]; string otherData=Request[ otherData ]; string PrimaryKey=Request[ PrimaryKey ]; data Set(PersonSetTable UserName UserName); data Set(PersonSetTable Sex Sex); data Set(PersonSetTable Age Age); data Set(PersonSetTable IsBeiJing IsBeiJing); data Set(PersonSetTable AgePeriod AgePeriod); data SetOnlyMark(PersonSetTable ID Equal(long Parse(PrimaryKey))); DBFactory Update(data); ReturnTextString(PrimaryKey); }
// 页面效果及代码生成效果
第二部分 高效便捷的ORM架构
背景
针对Qin Data的架构设计反应出的一些问题进行了全新的架构设计 弥补了多数据源使用不便 同道反应不过ORM 自身架构的瑕疵等问题
介绍
Moon ORM是一个通用数据库处理框架(可以包含MSSQL POSTGRESQL SQLITE EXCEL MYSQL DB ORACLE 只要你愿意实现接口就可以) 很便捷地进行常用数据库 *** 作(增删改查) 其性能是几近纯ADO NET 对于实体的查询采用emit实现 如果您还不满意可用此框架的代码生成器直接生成纯ADO NET SQL形式 其主要特色就是性能和便捷的 *** 作
特色
高性能(该框架采用纯的ADO NET进行框架 避免Linq以及反射带来的性能损失) 易用性强(配置简单 智能感知 代码生成器的辅助 会sql就可(可以自我性能优化)) 多数据库支持(如果需要可自我扩增 热烈欢迎同道加入团队开发中(联系qq: )) 强大查询语法糖功能 多数据源支持 < framework 20原生支持。tWwinGWit4、配置简单
<appSettings> <add key="dbType" value="MSSQL" /> <!--数据库的类型 还可以写MYSQL,SQLITE,ACCESS等—> <add key="linkString" value="Server=mainserver;database=HD01SystemDB;Uid=sa;Pwd=123" /> </appSettings>
代码功能演示
using System; using SystemCollectionsGeneric; using MoonOrm; using MoonDB; namespace r { class Program { public static void Main(string[] args) { //数据添加 PersonSet person=new PersonSet(); personAge=133; personAgePeriod=1; personIsBeiJing=true; personSex=true; personUserName="秦仕川"; DBFactoryAdd(person); ConsoleWriteLine("新的数据唯一识别标志:"+personGetOnlyMark()); //另类数据添加 personSet(PersonSetTableUserName,"另类"); personSet(PersonSetTableAge,12); personSet(PersonSetTableAgePeriod,11); personSet(PersonSetTableIsBeiJing,false); personSet(PersonSetTableSex,true); DBFactoryAdd(person); ConsoleWriteLine("新的数据11唯一识别标志:"+personGetOnlyMark()); //数据删除 long ret= DBFactoryDeleteWhen(PersonSetTableIsBeiJingEqual(1)And(PersonSetTableAgeBiggerThan(12))); ConsoleWriteLine("被删除的条数:"+ret); //改数据 personUserName="另类修改后"; personSetOnlyMark(PersonSetTableUserNameEqual("另类")); DBFactoryUpdate(person); //查询 PersonSet p=DBFactoryGetEntity<PersonSet>( PersonSetTableUserNameEqual("另类修改后")); ConsoleWriteLine(pAge); //查询一个字段 int age=DBFactoryGetOneField<int>(PersonSetTableAge, PersonSetTableIDEqual(5)); ConsoleWriteLine(age); ConsoleWrite("Press any key to continue "); ConsoleReadKey(true); } } }
实体代码生成器
数据库升级问题(我们常常面临数据库表的变动问题)
lishixinzhi/Article/program/net/201311/12132
<input type="checkbox" name="week" value="星期一" />星期一
<input type="checkbox" name="week" value="星期二" />星期二
<input type="checkbox" name="week" value="星期三" />星期三
<input type="checkbox" name="week" value="星期四" />星期四
<input type="checkbox" name="week" value="星期五" />星期五
<input type="checkbox" name="week" value="星期六" />星期六
<input name="ab" onclick="check()" type="button" value="确定" />
<div id="show">
</div>
<script>
function check()
{
obj=documentallweek;
for(i=0;i<weeklength;i++)
{
if(week[i]checked)
{
documentallshowinnerHTML+=week[i]value+",";
}
}
}
</script>
简单的一断JS,给你参考一下
asp教程用户注册实例程序
建立access数据库教程db mdb 在其中建立数据表user 字段分别为 u_uid(自动) u_user(用户名 文本型) u_pass(密码 文本型) 四 建立接收register asp中发送过来的表单数据 并插入到数据表user中的注册成功显示页面
<% 字符串连接数据库的方法 set conn=server createobject("adodb connection") conn open "driver=driver do microsoft access ( mdb);uid=admin;pwd=;dbq="&server mappath("regdb mdb") %>保存数据到数据库方法
lishixinzhi/Article/program/net/201311/14288
===================== 第一题 开始================
<html>
<head>
</head>
<body>
<%
Dim IP
IP=RequestServerVariables("REMOTE_ADDR")
If Mid(IP,1,7)="162105" Then
ResponseWrite "欢迎您"
Else
ResponseWrite "您是非法用户"
End If
%>
</body>
</html>
========================= 第一题 结束 =========================
第二题 开始
<html>
<body>
<%
If RequestCookies("user")="" Then
'如果是第一次访问,就让客户填写有关信息
ResponseWrite "您好,您是第一次访问本站,请填写个人信息"
%>
<form action="" method="post">
请输入姓名 : <input type="text" name="user_name">
请选择性别 : <input type="radio" name="sex" value="男">男
<input type="radio" name="sex" value="女">女
<input type="submit" value="提交">
</form>
<%
Elseif RequestCookies("user")("vNumber")>=1 Then
'如果不是第一次访问,就令访问次数在原有次数上加1
Dim vNumber '定义一个访问次数变量
Dim user_name
Dim sex
vNumber=RequestCookies("user")("vNumber")
user_name=RequestCookies("user")("user_name")
sex=RequestCookies("user")("sex")
ResponseCookies("user")("vNumber")=vNumber+1 '将访问次数加1保存到 Cookies 中
ResponseCookies("user")("user_name")=user_name
ResponseCookies("user")("sex")=sex
ResponseCookies("user")Expires=#2030-1-1# '设置有效期为20年,其实也没必要这么长
ResponseWrite RequestCookies("user")("user_name")&"您好,您是第"&(vNumber+1)&"次访问本站"
End If
'如果提交表单后执行如下语句
If RequestForm("user_name")<>"" And RequestForm("sex")<>"" Then
ResponseCookies("user")("user_name")=RequestForm("user_name")
ResponseCookies("user")("sex")=RequestForm("sex")
ResponseCookies("user")("vNumber")=1
ResponseCookies("user")Expires=#2030-1-1#
%>
</body>
</html>
第二题 结束
asp编程是基于vbscript,javascript,等脚本语言的一中web开发语言。默认的脚本语言是vbscript。asp的意思就是active service page 动态页面。气asp可以实现诸如网络聊天,bbs,留言板,新闻发布系统等等web应用程序,并且他的语法简单易学,很容易掌握。不管是什么web程序语言,都是主要是数据库的 *** 作,读写数据库。用动态语言来开发web应用程序,可以实时的更新你的网站数据,而不需要修改具体的网页页面。
现在的web开发语言有很多种,主要有asp,php,jsp等。各有优点
'
' 取得当前用户的IP地址
'
Private Function GetUserIP()
Dim strIP
'// 取得当前用户的返问IP
strIP = RequestServerVariables(">
以上就是关于编写ASP程序全部的内容,包括:编写ASP程序、另类的ASP.NET快速开发架构体系、用asp编写一个程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)