一个轻量级WebFramework开发框架介绍

基于MVC框架====地球人都知道
特性===多多
使用===方便
学习===简单
下面将在回复中慢慢介绍,想了解下的向下看

<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="/WEB-INF/webobject.xml" prefix="wo"%>
<%@page import="snowrain.webframework.web.border.*,snowrain.webframework.web.*"%>
<html>
<head>
<title>testtag</title>
</head>
<body bgcolor="ffffff">
<wo:webobject className="snowrain.webframework.web.border.BorderContent"> hahaaha
<wo:webobject className="snowrain.webframework.web.border.BorderContent"> xixixixxi
<%
ClipBorder cb = new ClipBorder();
cb.addWebText("This co中华人民共和国ntent<br>");
cb.setCaption("hehe,This is my caption");
%>
<wo:webobject webObject="<%=cb%>">asdfsadf</wo:webobject>
</wo:webobject>
</wo:webobject>
<wo:webobject className="snowrain.webframework.web.border.ClipBorder"> hahaaha
<wo:webobject className="snowrain.webframework.web.border.ClipBorder">hahaaha</wo:webobject>
</wo:webobject>
<wo:webobject fileName="ClipBorder">
Thddddddddddddddis is from xml
aa
<wo:webobject className="snowrain.webframework.web.border.BorderRoundCorner">hahaaha</wo:webobject>
</wo:webobject>
<!--
<wo:webobject className="snowrain.webframework.schema.PowerDesignerSelectTable"></wo:webobject>
-->
</body>
</html>

<img src="upload/luogQXtPJ.jpg">

这个演示了各种组件进行嵌套使用的结果

这样,每个组件都可以被重复使用,而不会有任何的问题。

<wo:webobject className="snowrain.webframework.web.border.ClipBorder">hahaaha</wo:webobject>

表示这里旋转一个Web组件,组件的类名是snowrain.webframework.web.border.ClipBorder,这主要用来放置不需要参数的组件。
组件间可以互相嵌套,同样的组件也可以互相嵌套。最终形成各种各样的效果

<%
ClipBorder cb = new ClipBorder();
cb.addWebText("This co中华人民共和国ntent<br>");
cb.setCaption("hehe,This is my caption");
%>
<wo:webobject webObject="<%=cb%>">asdfsadf</wo:webobject>
</wo:webobject>
对于复杂的组件,可能有些参数要在程序执行时才能确定,这样可以用程序的方法进行处理,然后直接放在Tag中即可,当然也可以封装一个类,在类内部进行处理,然后返回。

<wo:webobject fileName="ClipBorder">
Thddddddddddddddis is from xml
aa
<wo:webobject className="snowrain.webframework.web.border.BorderRoundCorner">hahaaha</wo:webobject>
</wo:webobject>
上面则演示了从配置文件中载入组件的示例,即根据配置的XML文件来形成一个组件,并显示之

组件的开发
一个圆角边框的开发示例
package snowrain.webframework.web.border;

import java.util.List;
import java.util.Properties;
import java.util.ArrayList;

import snowrain.webframework.web.*;
import snowrain.webframework.xsd.XsdElement;

/**
* 一个圆角边框
* @author snowrain
* @version 1.0
*/
public class BorderContent extends WebObject {
public static String Path = "borderContent/";
private static String Skin = "yellow";
private String ContentBackGroundColor = "fbfdf0";
/**
* 构造函数
*/
public BorderContent() {
}

/**
* 构造函数
* @param path String 图象路径
* @param skin String Skin名
* @param bgColor String 背景颜色
*/
public BorderContent(String path, String skin, String bgColor) {
Path = path;
Skin = skin;
ContentBackGroundColor = bgColor;
}

/**
* 构造函数
* @param path String 图象路径
* @param skin String Skin名
*/
public BorderContent(String path, String skin) {
Path = path;
Skin = skin;
}

/**
* 构造函数
* @param skin String Skin名
*/
public BorderContent(String skin) {
Skin = skin;
}

/**
* 返回用到的CSS文件名
* @return String
*/
public static String getCssFile() {
return Path + Skin + "/border.css";
}

/**
* 设置路径
* @param path String
*/
public static void setPath(String path) {
Path = path;
}

/**
* 用于从XML读入参数停息
* @param prop Properties
*/
public void parameterFromProperties(Properties prop) {
super.parameterFromProperties(prop);
Path = prop.getProperty("Path");
Skin = prop.getProperty("Skin");
ContentBackGroundColor = prop.getProperty("ContentBackGroundColor");
}

/**
* 提供克隆方法
* @return WebObject
*/
public WebObject cloneWebObject() {
return this;
}

/**
* 返回下面部分的内容
* @return String
*/
public String getFooter() {
if (!isInit) {
init();
}
String imagePath = (Path.endsWith("/") ? Path : (Path + "/")) + Skin +
"/";
String str = "";
str += " </td>\n";
str += " <td valign=\"top\" width=\"7\" background=\"" +
imagePath + "middleRight.gif\"><img src=\"" +
imagePath +
"middleRight.gif\" width=\"7\" height=\"21\"></td>\n";
str += " </tr>\n";
str += " </table>\n";
str += " </td>\n";
str += " </tr>\n";
str += " <tr>\n";
str += " <td valign=\"top\">\n";
str += " <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
str += " <tr>\n";
str += " <td width=\"10\"><img src=\"" + imagePath +
"bottomLeft.gif\" width=\"10\" height=\"11\"></td>\n";
str += " <td width=\"*\" background=\"" + imagePath +
"bottomMiddle.gif\"><img src=\"" + imagePath +
"bottomMiddle.gif\" width=\"2\" height=\"11\"></td>\n";
str += " <td width=\"9\"><img src=\"" + imagePath +
"bottomRight.gif\" width=\"9\" height=\"11\"></td>\n";
str += " </tr>\n";
str += " </table>\n";
str += " </td>\n";
str += " </tr>\n";
str += "</table>\n";

return str;
}

/**
* 返回上面部分的内容
* @return String
*/
public String getHeader() {
if (!isInit) {
init();
}
String imagePath = (Path.endsWith("/") ? Path : (Path + "/")) + Skin +
"/";
String str = "";
str +=
"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n";
str += " <tr>\n";
str += " <td valign=\"top\">\n";
str += " <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
str += " <tr>\n";
str += " <td width=\"9\"><img src=\"" + imagePath +
"topLeft.gif\" width=\"9\" height=\"8\"></td>\n";
str += " <td width=\"*\" background=\"" + imagePath +
"topMiddle.gif\"><img src=\"" + imagePath +
"topMiddle.gif\" width=\"4\" height=\"8\"></td>\n";
str += " <td width=\"9\"><img src=\"" + imagePath +
"topRight.gif\" width=\"9\" height=\"8\"></td>\n";
str += " </tr>\n";
str += " </table>\n";
str += " </td>\n";
str += " </tr>\n";
str += " <tr>\n";
str += " <td valign=\"top\">\n";
str += " <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
str += " <tr>\n";
str += " <td valign=\"top\" width=\"6\" background=\"" +
imagePath + "middleLeft.gif\"><img src=\"" +
imagePath +
"middleLeft.gif\" width=\"6\" height=\"20\"></td>\n";
str += " <td width=\"*\" bgcolor=\"" + ContentBackGroundColor +
"\">\n";
return str;
}

/**
* 提供从XML读入参数的方式
* @param prop Properties
*/
public void parameterToProperties(Properties prop) {
super.parameterToProperties(prop);
if (Path != null) {
prop.setProperty("Path", Path);
}
if (Skin != null) {
prop.setProperty("Skin", Skin);
}
if (ContentBackGroundColor != null) {
prop.setProperty("ContentBackGroundColor", ContentBackGroundColor);
}
}

/**
* 如果检测到没有添加内容,则自动添加一个空格进去
*/
public void init() {
super.init();
this.addWebText(" ");
}

/**
* 用于生成Xml Schema
* @return List
*/
public List getParameterList() {
ArrayList al = new ArrayList();
al.add(new XsdElement("Path", "string", 0, 1));
al.add(new XsdElement("Skin", "string", 0, 1));
al.add(new XsdElement("ContentBackGroundColor", "string", 0, 1));
return al;
}

}

圆角边框的执行效果

当然了,看看上面的编辑是有些复杂的,那么有没有办法,更简单的实现一下它呢?各种内容都要print出来,要实现的函数又有那么多?

答案当然是肯定的,那就是采用模板的方式,请看下一篇回复

下面是这个圆角边框的html源代码,把它放在一个html文件中
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="9"><img src="borderContent/yellow/topLeft.gif" width="9" height="8"></td>
<td width="*" background="borderContent/yellow/topMiddle.gif"><img src="borderContent/yellow/topMiddle.gif" width="4" height="8"></td>
<td width="9"><img src="borderContent/yellow/topRight.gif" width="9" height="8"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="6" background="borderContent/yellow/middleLeft.gif"><img src="borderContent/yellow/middleLeft.gif" width="6" height="20"></td>
<td width="*" bgcolor="fbfdf0">
  <span snwf="@content"></span>
</td>
<td valign="top" width="7" background="borderContent/yellow/middleRight.gif"><img src="borderContent/yellow/middleRight.gif" width="7" height="21"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"><img src="borderContent/yellow/bottomLeft.gif" width="10" height="11"></td>
<td width="*" background="borderContent/yellow/bottomMiddle.gif"><img src="borderContent/yellow/bottomMiddle.gif" width="2" height="11"></td>
<td width="9"><img src="borderContent/yellow/bottomRight.gif" width="9" height="11"></td>
</tr>
</table>
</td>
</tr>
</table>

<span snwf="@content"></span>是用来表示,这个地方,是用来放内容地,如此,一个简单的组件就做好了。

当然了,我们做的组件是用来组成大的程序的,怎么把它们组织在一起呢?

一种是用代码写组件,如下是一个从pdm文件中,生成表列表的组件:


package snowrain.webframework.schema;

import snowrain.webframework.web.*;
import snowrain.webframework.web.border.*;
import snowrain.webframework.web.table.*;
import snowrain.webframework.web.button.*;
import snowrain.webframework.web.input.*;
import snowrain.webframework.web.misc.*;
import java.util.*;

public class PowerDesignerSelectTable extends WebObject {
PowerDesignerXml pdo;
private String pdm = null;
private void saveParameters(String tbid, WebInputForm form) {
PowerDesignerXml columns = pdo.getObjectByID(tbid).getObjectByName(
"c:Columns");
if (columns != null) {
for (int i = 0; i < columns.SubObjects.size(); i++) {
PowerDesignerXml c = (PowerDesignerXml) columns.SubObjects.get(
i);
WebInputHidden col = new WebInputHidden("sel_" +
c.getAttribute("Id"));
form.addWebObject(col);
}
}
}

public PowerDesignerSelectTable() {
pdo = PowerDesignerXml.loadSchema("D:/project_mz2/ddl/mz2.pdm");
}

public void init() {
super.init();
System.out.println("init select table");
String sel_table = getWebPageObject().getFromRequest("sel_table");
WebInputForm form = new WebInputForm();
addWebObject(form);
form.setProperty("action",
"snowrain.webframework.schema.PowerDesignerSelectColumn.vc");
ClipBorder border = new ClipBorder();
if (sel_table != null) {
saveParameters(sel_table, form);
}
form.addWebObject(border);
border.setWidth("100%");
border.setCaption("选择要生成的表");
WebTable tb = new WebTable();
border.addWebObject(tb);
tb.setProperty("width", "100%");
tb.setProperty("cellspacing", 0);
tb.setProperty("border", 1);
PowerDesignerXml tables = pdo.getObjectByName("c:Tables");
WebTR tr = new WebTR();
tb.addWebObject(tr);
tb.setProperty("bgcolor", "FFFFFF");
WebTH th = new WebTH();
tr.addWebObject(th);
th.addWebText("选择");
th = new WebTH();
tr.addWebObject(th);
th.addWebText("英文表名");
th = new WebTH();
tr.addWebObject(th);
th.addWebText("中文表名");
th = new WebTH();
tr.addWebObject(th);
th.addWebText("说明信息");
for (int i = 0; i < tables.SubObjects.size(); i++) {
PowerDesignerXml table = (PowerDesignerXml) tables.SubObjects.get(i);
tr = new WebTR();
tb.addWebObject(tr);
WebTD td = new WebTD();
tr.addWebObject(td);
td.setProperty("align", "center");
boolean s = false;
if (sel_table == null) {
s = (0 == i);
} else {
sel_table.equals(table.getAttribute("Id"));
}
td.addWebObject(new WebInputRadioBox("sel_table",
table.getAttribute("Id"),
"", s));
td = new WebTD();
tr.addWebObject(td);
td.addWebText(table.getProperty("a:Code").toLowerCase());
td = new WebTD();
tr.addWebObject(td);
td.addWebText(table.getProperty("a:Name"));
td = new WebTD();
tr.addWebObject(td);
td.addWebText(table.getProperty("a:Comment"));
}
WebDiv gr = new WebDiv();
border.addWebObject(gr);
gr.setProperty("align", "center");
WebSubmitButton sb = new WebSubmitButton("ok", "下一步");
gr.addWebObject(sb);
}
}
下面是组件结果:

做了组件,是为了使用,那么怎么使用它呢:

一,在做组件时使用

WebObject x= new 某组件类名;
x.addWebObject(new PowerDesignerSelectTable());
这样就把它加入了
二,在jsp上显示
<wo:webobject className="snowrain.webframework.schema.PowerDesignerSelectTable"></wo:webobject>
三,在模板中引用
<span snwf="@WebObject" className="snowrain.webframework.schema.PowerDesignerSelectTable"></span>

做了组件,是为了使用,那么怎么使用它呢:

一,在做组件时使用

WebObject x= new 某组件类名;
x.addWebObject(new PowerDesignerSelectTable());
这样就把它加入了
二,在jsp上显示
<wo:webobject className="snowrain.webframework.schema.PowerDesignerSelectTable"></wo:webobject>
三,在模板中引用
<span snwf="@WebObject" className="snowrain.webframework.schema.PowerDesignerSelectTable"></span>

所有的组件都可以被固化为xml,这个有什么作用呢?

这就说明了,所有的组件都是可以被配置的------有点类似于spring的bean方式,但是比那里的bean要复杂的多。

下面将会演示一个比较复杂的应用....

它完成了表格显示,排序,格式化,添加、修改、删除等等所有功能,但是实际上只是两个XML配置文件,有兴趣的话,请继续看下一篇回复。

一个表格的XML描述

<?xml version="1.0" encoding="UTF-8"?>
<ClipBorder ID="9883b1c01c0611dab4c800096b7a44ed" ClassName="snowrain.webframework.web.border.ClipBorder" type="WebObject">
<Parameters>
<Caption>表管理</Caption>
<Width>100%</Width>
<ShowSingleLine>false</ShowSingleLine>
<Path>clipimages/</Path>
<ContentBackGroundColor>fbfdf0</ContentBackGroundColor>
<Height>*</Height>
</Parameters>
<WebDBTable ID="63a4c4f01e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.webdb.WebDBTable" type="WebObject">
<Parameters>
<pageSize>10</pageSize>
<isShowFooterPageNavigator>true</isShowFooterPageNavigator>
<ShowSingleLine>false</ShowSingleLine>
<isShowHeader>true</isShowHeader>
<isShowHeaderPageNavigator>true</isShowHeaderPageNavigator>
<PrimaryField>id</PrimaryField>
</Parameters>
<DBConn ClassName="snowrain.webframework.database.DBConn">
<Parameters>
<dbtype>2</dbtype>
<BeanFile>E:/dbak/WebFramework/webtest/WEB-INF/beans.xml</BeanFile>
</Parameters>
</DBConn>
<DataSource ClassName="snowrain.webframework.database.DataSource">
<Parameters>
<SQLQuery>select * from aaa</SQLQuery>
</Parameters>
<DefaultShortFields>
</DefaultShortFields>
</DataSource>
<ResultSetTable ClassName="snowrain.webframework.web.webdb.ResultSetTable">
<Parameters>
<tableName>aaa</tableName>
<tableTitle>aaa</tableTitle>
</Parameters>
<RecordField ClassName="snowrain.webframework.web.webdb.RecordField">
<Properties>
<Property name="class">grid</Property>
</Properties>
<Parameters>
<allowSort>false</allowSort>
<fieldLabel>c1</fieldLabel>
<InputType>IT_TEXT</InputType>
<fieldName>c1</fieldName>
</Parameters>
</RecordField>
<RecordField ClassName="snowrain.webframework.web.webdb.RecordField">
<Properties>
<Property name="class">grid</Property>
</Properties>
<Parameters>
<allowSort>false</allowSort>
<fieldLabel>c2</fieldLabel>
<InputType>IT_TEXT</InputType>
<fieldName>c2</fieldName>
</Parameters>
</RecordField>
<RecordField ClassName="snowrain.webframework.web.webdb.RecordField">
<Properties>
<Property name="class">grid</Property>
</Properties>
<Parameters>
<allowSort>false</allowSort>
<fieldLabel>c3</fieldLabel>
<InputType>IT_TEXT</InputType>
<fieldName>c3</fieldName>
</Parameters>
</RecordField>
</ResultSetTable>
<TableOperation ID="63a7d2301e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.webdb.TableOperation" type="WebObject">
<Parameters>
<ShowSingleLine>false</ShowSingleLine>
<formPage>?</formPage>
</Parameters>
<WebHref ID="63a7d2311e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.button.WebHref" type="WebObject">
<Properties>
<Property name="href">aaa_form.view</Property>
<Property name="title">添加新记录</Property>
</Properties>
<Parameters>
<ShowSingleLine>true</ShowSingleLine>
<TagName>a</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">3</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
<WebText ID="63a958d01e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.misc.WebText" type="WebObject">
<Parameters>
<ShowSingleLine>false</ShowSingleLine>
<text>添加</text>
<IsHtmlFormat>false</IsHtmlFormat>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">3</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
</WebText>
</WebHref>
</TableOperation>
<RecordOperation ID="63a958d11e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.webdb.RecordOperation" type="WebObject">
<Parameters>
<imagePath>image/</imagePath>
<ShowSingleLine>false</ShowSingleLine>
<formPage>?</formPage>
</Parameters>
<WebHref ID="63a958d21e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.button.WebHref" type="WebObject">
<Properties>
<Property name="href">aaa_form.view</Property>
</Properties>
<Parameters>
<ShowSingleLine>true</ShowSingleLine>
<TagName>a</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">1</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
<WebImage ID="63a958d31e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.misc.WebImage" type="WebObject">
<Properties>
<Property name="alt">查看记录</Property>
<Property name="src">image/iconview.gif</Property>
</Properties>
<Parameters>
<ShowSingleLine>false</ShowSingleLine>
<TagName>img</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">1</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
</WebImage>
</WebHref>
<WebHref ID="63a958d41e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.button.WebHref" type="WebObject">
<Properties>
<Property name="href">aaa_form.view</Property>
</Properties>
<Parameters>
<ShowSingleLine>true</ShowSingleLine>
<TagName>a</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">2</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
<WebImage ID="63a958d51e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.misc.WebImage" type="WebObject">
<Properties>
<Property name="alt">修改记录</Property>
<Property name="src">image/iconedit.gif</Property>
</Properties>
<Parameters>
<ShowSingleLine>false</ShowSingleLine>
<TagName>img</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">2</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
</WebImage>
</WebHref>
<WebHref ID="63a958d61e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.button.WebHref" type="WebObject">
<Properties>
<Property name="href">aaa_form.view</Property>
</Properties>
<Parameters>
<ShowSingleLine>true</ShowSingleLine>
<TagName>a</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">4</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
<WebImage ID="63a958d71e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.misc.WebImage" type="WebObject">
<Properties>
<Property name="alt">复制记录</Property>
<Property name="src">image/iconcopy.gif</Property>
</Properties>
<Parameters>
<ShowSingleLine>false</ShowSingleLine>
<TagName>img</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">4</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
</WebImage>
</WebHref>
<WebHref ID="63a958d81e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.button.WebHref" type="WebObject">
<Properties>
<Property name="href">aaa_form.view</Property>
<Property name="onclick">javascript:return(confirm(&apos;你确认要删除这条记录吗?&apos;))</Property>
</Properties>
<Parameters>
<ShowSingleLine>true</ShowSingleLine>
<TagName>a</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">7</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
<WebImage ID="63a958d91e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.misc.WebImage" type="WebObject">
<Properties>
<Property name="alt">删除记录</Property>
<Property name="src">image/icondel.gif</Property>
</Properties>
<Parameters>
<ShowSingleLine>false</ShowSingleLine>
<TagName>img</TagName>
</Parameters>
<WebUrlParameter ClassName="snowrain.webframework.web.misc.WebUrlParameter">
<Properties>
<Property name="sjl_showtype">7</Property>
</Properties>
<Parameters>
<AcceptURLParameterMode>3</AcceptURLParameterMode>
</Parameters>
</WebUrlParameter>
</WebImage>
</WebHref>
</RecordOperation>
<TableProperties>
<Property name="width">100%</Property>
<Property name="class">grid</Property>
</TableProperties>
<ContentTdProperties>
<Property name="class">grid</Property>
<Property name="align">left</Property>
</ContentTdProperties>
<RecordOperationProperties>
<Property name="class">grid</Property>
<Property name="align">center</Property>
</RecordOperationProperties>
</WebDBTable>
</ClipBorder>

数据操纵的XML描述
<?xml version="1.0" encoding="UTF-8"?>
<ClipBorder ID="9883b1c01c0611dab4c800096b7a44ed" ClassName="snowrain.webframework.web.border.ClipBorder" type="WebObject">
<Parameters>
<Caption>aaa管理窗口aaa</Caption>
<Width>100%</Width>
<ShowSingleLine>false</ShowSingleLine>
<Path>clipimages/</Path>
<ContentBackGroundColor>fbfdf0</ContentBackGroundColor>
<Height>*</Height>
</Parameters>
<WebDBForm ID="640694001e8411dab21700096b7a44ed" ClassName="snowrain.webframework.web.webdb.WebDBForm" type="WebObject">
<Parameters>
<ShowSingleLine>false</ShowSingleLine>
<formType>FORM_VIEW</formType>
<OutPage>aaa_table.view</OutPage>
<PrimaryField>id</PrimaryField>
</Parameters>
<DBConn ClassName="snowrain.webframework.database.DBConn">
<Parameters>
<dbtype>2</dbtype>
<BeanFile>E:/dbak/WebFramework/webtest/WEB-INF/beans.xml</BeanFile>
</Parameters>
</DBConn>
<DataSource ClassName="snowrain.webframework.database.DataSource">
<Parameters>
<SQLQuery>select * from aaa</SQLQuery>
</Parameters>
<DefaultShortFields>
</DefaultShortFields>
</DataSource>
<ResultSetTable ClassName="snowrain.webframework.web.webdb.ResultSetTable">
<Parameters>
<tableName>aaa</tableName>
<tableTitle>aaa</tableTitle>
</Parameters>
<RecordField ClassName="snowrain.webframework.web.webdb.RecordField">
<Properties>
<Property name="class">grid</Property>
</Properties>
<Parameters>
<allowSort>false</allowSort>
<fieldLabel>c1</fieldLabel>
<InputType>IT_TEXT</InputType>
<fieldName>c1</fieldName>
</Parameters>
</RecordField>
<RecordField ClassName="snowrain.webframework.web.webdb.RecordField">
<Properties>
<Property name="class">grid</Property>
</Properties>
<Parameters>
<allowSort>false</allowSort>
<fieldLabel>c2</fieldLabel>
<InputType>IT_TEXT</InputType>
<fieldName>c2</fieldName>
</Parameters>
</RecordField>
<RecordField ClassName="snowrain.webframework.web.webdb.RecordField">
<Properties>
<Property name="class">grid</Property>
</Properties>
<Parameters>
<allowSort>false</allowSort>
<fieldLabel>c3</fieldLabel>
<InputType>IT_TEXT</InputType>
<fieldName>c3</fieldName>
</Parameters>
</RecordField>
</ResultSetTable>
<RecordFormat>
</RecordFormat>
</WebDBForm>
</ClipBorder>

执行结果:
下面是表格

大家看到的结果,可能有些不太漂亮,但是细心的人可能已经注意到了,里面的table,tr,td的属性在xml中可以任意配置,也可以添加各种其它内容。如样式,背景图片等等.....
下面是修改窗口

既然说到是MVC结果,M自不言说,C又是怎么实现的呢?

此间的人地Struts,Spring,TypeStry,等等框架应该都比较熟悉的...
这里的C,不求好看,只求易用(实际上也比较好看的说)

有兴趣的人看下一篇回复..

先简单看一个重定向的Action...
<WebActionRedirect ClassName="snowrain.webframework.web.action.WebActionRedirect">
<FormatPattern ClassName="snowrain.webframework.format.FormatPattern" type="FormatBase">
<Parameters>
<SourceString>/webtest/testtag.jsp</SourceString>
</Parameters>
</FormatPattern>
</WebActionRedirect>

即,如果要执行此Action,将会转到/webtest/testta.jsp上...
有人问,如果要是有复杂的参数要添加呢?
FormatPattern是一个带Pattern的Format类,因此,可以根据需要格式化出需要的结果,默认功能已经非常强大了,如果不够用,可以自己写个类换进去。