社区
Web 开发
帖子详情
讨论:JSP系统结构的应用模式
bukebushuo
2003-09-29 02:40:10
大家好,我最近试用了一个WEB系统,多层结构,客户端为HTML,使用JRUN+IIS
工作原理是HTML页面SUBMIT后,SERVLET取得叶面URL,然后取得所有参数,提交得到返回的数据,然后根据取得的URL读取HTML,然后把传回来的数据一起重新构造一个叶面送回客户端。大体就是这样的。
我想问的是,有没有人以前用过这样的系统或者技术?就是读取叶面代码,结合已有数据重新生成包含数据的叶面,然后送回!
...全文
33
2
打赏
收藏
讨论:JSP系统结构的应用模式
大家好,我最近试用了一个WEB系统,多层结构,客户端为HTML,使用JRUN+IIS 工作原理是HTML页面SUBMIT后,SERVLET取得叶面URL,然后取得所有参数,提交得到返回的数据,然后根据取得的URL读取HTML,然后把传回来的数据一起重新构造一个叶面送回客户端。大体就是这样的。 我想问的是,有没有人以前用过这样的系统或者技术?就是读取叶面代码,结合已有数据重新生成包含数据的叶面,然后送回!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
gks_cn
2003-09-29
打赏
举报
回复
驱动的bean
// $Id: Dept.java,v 1.6 2000/01/10 19:08:14 gongke Exp $
package peiyang.priv;
import util.db.DB;
import sun.jdbc.rowset.CachedRowSet;
import util.string.StringUtil;
import java.util.Vector;
import java.sql.*;
import java.io.*;
public class Dept{
private int deptId;
private String deptName;
private String deptDiscription;
private String note;
private String action = ""; //控制器
private boolean valid = true;
private String erroMsg = "";
private String statusMsg;
public String getAction() {
return this.action;
}
public void setAction(String action) {
this.action = action;
}
public int getDeptId() {
return this.deptId;
}
public void setDeptId(int deptId) {
this.deptId = deptId;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getDeptName() {
return this.deptName;
}
public void setDeptDiscription(String deptDiscription) {
this.deptDiscription = deptDiscription;
}
public String getDeptDiscription() {
return this.deptDiscription;
}
public void setNote(String note) {
this.note = note;
}
public String getNote() {
return this.note;
}
public Dept() {
}
public void escapSQLTag() {
this.deptDiscription = util.string.StringUtil.escapeSQLTags(this.
deptDiscription);
this.deptName = util.string.StringUtil.escapeSQLTags(this.
deptName);
this.note = util.string.StringUtil.escapeSQLTags(this.
note);
}
public String dbProcess() {
DB mydb = new DB();
String msg = null;
if (this.action.equals("add")) { //收到添加的信息就添加
try {
escapSQLTag();
if (this.isValid()) {
String sql =
"insert into Dept (deptId,deptName,deptDiscription,note)" +
"values (s_deptId.nextval,'" + StringUtil.toGb(this.deptName) +
"','" +
StringUtil.toGb(this.deptDiscription) + "','" +
StringUtil.toGb(this.note) + "')";
System.out.println(sql);
mydb.execute(sql);
msg = "<script> alert('添加成功')</script>";
}
else {
msg = "<script> alert ('" + this.getErroMsg() + "')</script>";
}
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
if (this.action.equals("del")) { //收到删除的信息就添加
try {
String sql = "delete from Dept where deptId=" + this.deptId;
System.out.println(sql);
mydb.execute(sql);
msg = "<script>alert('删除成功')</script>";
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
if (this.action.equals("edit")) { //收到修改的信息就添加
try {
escapSQLTag();
if (this.isValid()) {
String sql = "update Dept set deptName='" +
StringUtil.toGb(this.deptName)
+ "',deptDiscription='" + StringUtil.toGb(this.deptDiscription)
+ "',note='" + StringUtil.toGb(this.note)
+ "' where deptId=" + this.deptId;
System.out.println(sql);
mydb.execute(sql);
msg = "<script>alert('修改成功')</script>";
}
else {
msg = "<script> alert ('" + this.getErroMsg() + "')</script>";
}
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
return msg;
}
public void loadRecord() {
DB mydb = new DB();
try {
String sql = "select * from Dept where deptId=" + this.deptId;
System.out.println(sql);
CachedRowSet rs = mydb.executeQuery(sql);
if (rs.next()) { //返回数据库记录
this.deptDiscription = rs.getString("deptDiscription");
this.deptName = rs.getString("deptName");
this.note = rs.getString("note");
}
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
public CachedRowSet getList() throws SQLException {
CachedRowSet rs = new CachedRowSet();
DB mydb = new DB();
String sql = "select * from Dept";
rs = mydb.executeQuery(sql);
return rs;
}
private boolean isStringValid(String s, int maxlength) {
if (s != null) {
if (s.length() > maxlength) {
return false;
}
}
else {
return false;
}
return true;
}
public boolean isValid() {
if (!isStringValid(this.deptName, 50)) {
this.setErroMsg("部门不能为空,并且长度不能大于50");
this.setValid(false);
return false;
}
this.setValid(true);
return true;
}
public void setValid(boolean valid) {
this.valid = valid;
}
public String getErroMsg() {
return erroMsg;
}
public void setErroMsg(String erroMsg) {
this.erroMsg = erroMsg;
}
public static void main(String args[]) {
Dept d = new Dept();
d.setAction("add");
d.setDeptName("a");
d.setNote("n");
System.out.println(d.isValid());
System.out.println(d.getErroMsg());
}
public String getStatusMsg() {
return statusMsg;
}
public void setStatusMsg(String statusMsg) {
this.statusMsg = statusMsg;
}
}
gks_cn
2003-09-29
打赏
举报
回复
<%// $Id: edit.jsp,v 1.10 2000/01/10 18:43:18 gongke Exp $%>
<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="../../inc/head.jsp"%>
<jsp:useBean id="dept" class="peiyang.priv.Dept" scope="request">
<jsp:setProperty name="dept" property="*"/>
</jsp:useBean>
<%
dept.loadRecord();//将数据库里面的记录通过deptid传到bean里面
%>
<html>
<head>
<title>
</title>
<link rel="stylesheet" href="../../inc/main.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body background="../../images/line.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<br>
<form name="form1" method="post" action="process.jsp">
<table width="600" border="0" cellpadding="0" cellspacing="0" >
<tr height=25>
<td class=cl1_titleoff align=center colspan=2><font class=m2_1>部门</font></td>
</tr>
<tr>
<td class="mode4"> <img src=../../images/blank.gif width=10 height="1">部门名称</td>
<td class="mode5"><img src="../../images/blank.gif" width="10" height="1">
<input name="deptName" type="text" class="huaxian" id="deptName" value="<jsp:getProperty
name="dept" property="deptName"/>"> </td>
</tr>
<tr>
<td class="mode4"><img src=../../images/blank.gif width=10 height="1">部门描述</td>
<td class="mode5"><img src="../../images/blank.gif" width="10" height="1">
<textarea name="deptDiscription" cols="50" rows="5" class="huaxian" id="deptDiscription"><jsp:getProperty
name="dept" property="deptDiscription"/></textarea>
</td>
</tr>
<tr>
<td class="mode4"><img src=../../images/blank.gif width=10 height="8">备注</td>
<td class="mode5"><img src="../../images/blank.gif" width="10" height="1">
<input name="note" type="text" class="huaxian" id="note" value="<jsp:getProperty
name="dept" property="note"/>"> </td>
</tr>
<tr>
<td class="mode4"><img src=../../images/blank.gif width=10 height="8">相关操作
</td>
<td class="mode5"><img src="../../images/blank.gif" width="10" height="1">
<%
if (request.getParameter("action")==null){
%> <input name="edit" type="submit" class="cl2_ipt" value="添加" onClick="form1.action.value='add'">
<%
}else{
%> <input name="edit" type="submit" class="cl2_ipt" value="编辑" onClick="form1.action.value='edit'">
<input name="deptId" type="hidden" id="deptId" value="<jsp:getProperty name="dept" property="deptId"/>">
<input name="del" type="submit" class="cl2_ipt" value="删除" onClick="form1.action.value='del'">
<%
}
%>
<input name="action" type="hidden" id="action"> <input name="button" type="button" class="cl2_ipt" value="返回" onClick="window.location='index.jsp'">
</td>
</tr>
</table>
<br>
<jsp:getProperty name="dept" property="erroMsg"/>
</form>
</center>
</body>
</html>
互联网
应用
软件系统架构
模式
的确立
互联网
应用
软件系统 架构
模式
的确立作者:欧阳翔Email: ouyang.xiang@gmail.com课程目的. 分享个人心得,以此展开
讨论
,获得更进 一步的提升;. 统一团队设计思想,达成共识,更好的规 范开发流程,提升开发效率;. ...
【计算机毕业设计】基于
JSP
的网上购物系统的设计与实现
分类号:TP315 U D C:D10621-408-(2007)5883-0密 级:公 开 编 号:2003214012学位论文基于
JSP
的网上购物系统的设计与实现基于
JSP
的网上购物系统的设计与实现摘 要近年来,随着Internet的迅速崛起,互联网已日益...
MVC
模式
/Servlet/
JSP
编译原理剖析:Servlet 组件到底属于 MVC
模式
的哪一层?
今天课下,偶然听到有几个同学在
讨论
这么一个问题:Servlet 到底属于 MVC
模式
的哪一层?谈到这个问题就考察你对于 MVC
模式
的熟悉程度了。本篇我们就分别从 MVC
模式
、Servlet 和
JSP
的原理来探讨一下,Servlet ...
基于
JSP
的健身俱乐部会员管理系统的设计与实现(论文+PPT+源码)
该课题是基于Windows的操作系统,后台数据库采用MySQL,前端使用
JSP
进行开发。本课题所研究的健身俱乐部管理系统主要由六个模块组成,即人事资料模块、预约管理模块、器材管理模块、会员管理模块、系统管理模块。...
JSP
设计
模式
(转载)
jsp
设计
模式
---MVC
模式
一:介绍以前自己是写asp和php代码的,后来为了赶上时代的步伐吧.我开始涉足
jsp
....当然这个就是我今天要和大家
讨论
的在
jsp
中实现MVC三层
模式
.二:什么是MVCMVC是MODEL_VIEW_CONTR
Web 开发
81,092
社区成员
341,716
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章