社区
Web 开发
帖子详情
讨论:JSP系统结构的应用模式
bukebushuo
2003-09-29 02:40:10
大家好,我最近试用了一个WEB系统,多层结构,客户端为HTML,使用JRUN+IIS
工作原理是HTML页面SUBMIT后,SERVLET取得叶面URL,然后取得所有参数,提交得到返回的数据,然后根据取得的URL读取HTML,然后把传回来的数据一起重新构造一个叶面送回客户端。大体就是这样的。
我想问的是,有没有人以前用过这样的系统或者技术?就是读取叶面代码,结合已有数据重新生成包含数据的叶面,然后送回!
...全文
91
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>
MVC设计
模式
简介
本文介绍了MVC设计
模式
的基本概念,包括M(Model)数据模型层、V(View)视图层和C(Controller)控制层的具体职责。
讨论
了MVC
模式
在Web开发中的
应用
,如JavaBean作为Model,Servlet作为Controller,
JSP
作为View的角色分配。同时,还分析了MVC
模式
的优点和缺点。
Java、
JSP
网上购书系统
本文详细介绍了使用Java、
JSP
、Servlet、JavaBean和Hibernate技术开发的网上购书系统。系统涵盖了用户注册、登录、购物车管理、订单处理等功能,并利用Oracle数据库存储数据。通过MVC
模式
实现架构,
讨论
了各技术的原理和
应用
,以及系统的全面测试。
SpringMVC(一)MVC设计
模式
本文详细介绍了MVC设计
模式
,包括其组成部分:Model数据模型层、View视图层和Controller控制层。MVC
模式
的主要特点是代码分离,提高可重用性和松耦合。在
JSP
+JavaBean和Servlet+
JSP
+JavaBean两种开发
模式
中,分别阐述了它们的适用场景。此外,还
讨论
了MVC
模式
的优缺点,如灵活性、可配置性,但同时也存在复杂性和效率问题。关键词涵盖了MVC
模式
的主要概念和技术。
JSP
实现的车辆管理系统详解与操作
本文围绕基于
JSP
技术的车辆管理系统展开,介绍了
JSP
技术基础,阐述系统架构设计原则、技术选型,详细说明用户登录、车辆信息管理等功能模块,还涉及数据库设计、
JSP
页面开发等实现细节,以及系统部署、运行监控、维护升级等内容。
Java、
JSP
超市管理系统
本文介绍了一款使用Java和
JSP
技术开发的超市管理系统。该系统旨在提高超市信息管理效率,通过收集、存储超市档案信息,提供更新和检索功能。系统详细
讨论
了开发背景、目的、设计思路以及技术选型,包括
JSP
、MySQL数据库和B/S
模式
。此外,还涵盖了需求分析、可行性研究、系统设计与测试等方面,展示了从概念到实现的完整过程。
Web 开发
81,111
社区成员
341,726
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章