社区
Web 开发
帖子详情
讨论:JSP系统结构的应用模式
bukebushuo
2003-09-29 02:40:10
大家好,我最近试用了一个WEB系统,多层结构,客户端为HTML,使用JRUN+IIS
工作原理是HTML页面SUBMIT后,SERVLET取得叶面URL,然后取得所有参数,提交得到返回的数据,然后根据取得的URL读取HTML,然后把传回来的数据一起重新构造一个叶面送回客户端。大体就是这样的。
我想问的是,有没有人以前用过这样的系统或者技术?就是读取叶面代码,结合已有数据重新生成包含数据的叶面,然后送回!
...全文
64
2
打赏
收藏
讨论:JSP系统结构的应用模式
大家好,我最近试用了一个WEB系统,多层结构,客户端为HTML,使用JRUN+IIS 工作原理是HTML页面SUBMIT后,SERVLET取得叶面URL,然后取得所有参数,提交得到返回的数据,然后根据取得的URL读取HTML,然后把传回来的数据一起重新构造一个叶面送回客户端。大体就是这样的。 我想问的是,有没有人以前用过这样的系统或者技术?就是读取叶面代码,结合已有数据重新生成包含数据的叶面,然后送回!
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用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>
java架构师(必修书籍打包)
不要分,免费下! 包括的书籍有:J2EE架构师手册.rar、J2EE架构分析.doc、java设计层.pdf、Java软件构架设计
模式
.rar、J2EE架构师手册(英文版).chm
Java面试宝典 2013版(完整版)
涵盖12个点 一.java基础部分 二.算法与编程 三.html&JavaScript&ajax部分 四.Java web部分 五.数据库部分 六.XML部分 七.流行的框架与新技术 八.软件工程与设计
模式
九.j2ee部分 十.EJB部分 十—. webservice 部分 十二.其他
深入
JSP
课程设计:六大实际
应用
系统的构建与报告
本文还有配套的精品资源,点击获取 简介:
JSP
(JavaServer Pages)是一种结合HTML和Java代码创建动态Web
应用
的工具。本课程设计通过六个实际
应用
系统,如投票系统、通讯簿管理系统、新闻发布系统、软件下载中心、电子书店系统和论坛系统,详细讲解了
JSP
的原理与实践。学生将学会如何使用
JSP
进行交互式
应用
开发,掌握与数据库的交互,理解用户界面设计、数据安全和性...
构建在线论坛系统:
JSP
与SQL的实践
应用
本文还有配套的精品资源,点击获取 简介:“BBS论坛系统(
jsp
+sql).rar”压缩包提供了使用
JSP
技术和SQL数据库构建的在线
讨论
平台源代码。该系统包括用户互动、话题
讨论
和信息分享等核心功能,作为学习
JSP
和SQL集成
应用
的实用案例。通过理解系统源代码和数据库结构,学习者可以深入掌握Web开发的基础知识和数据库管理技能。 1.
JSP
技术基础
应用
1...
JSP
技术深入课程设计:构建动态Web
应用
本文还有配套的精品资源,点击获取 简介:
JSP
(Java Server Pages)是一种用于开发动态网页的强大技术,通过本课程设计,学生将深入学习
JSP
的基本概念、核心语法及
应用
技巧,并实践构建一个完整的Web项目。课程内容涵盖
JSP
基本元素、生命周期、内置对象、EL和JSTL使用、MVC
模式
应用
、数据库操作、文件上传下载、错误与异常处理以及安全机制等关键知识点。学生将通...
Web 开发
81,122
社区成员
341,744
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章