- 浏览: 246349 次
- 性别:
- 来自: 武汉
文章分类
最新评论
-
3w1h:
"2.对于外部查询中的每一行分别执行一次子查询,而且 ...
浅说:in、not in、exists和not exists的区别 -
danielhjd:
shishuang 写道[size=large][/size] ...
(SSH框架)Spring 和Struts的配置说明... -
shishuang:
[size=large][/size] 没有出来你strut ...
(SSH框架)Spring 和Struts的配置说明... -
daven1314:
不错,学习了!
(oracle)如何创建和使用procedure
1)many to one 关系表中cacsade属性,将属性设置为“add-update persist”可以在有级联关系的表中强制增加数据;
2)在呈现预览功能时最好是action 或者页面直接传值。建立一个简单的Viewbean也能解决此问题,但是的注意如果是同过get set方法取值的时候,数据会自动的set到取值的页面,影响下一步的操作;
3)代码:
public String add(){
//去掉这句执行语句红色部分?是否可以直接在此处进行对象的添加
String sName=this.getBranchdirectory();
this.ebaySortinfo= this.sortinfoDao.getSortsBySname(sName);
this.ebayBuygoods.setEbaySortinfo(ebaySortinfo);
// EbayUserinfo user=(EbayUserinfo)session.get();
// this.ebayBuygoods.setEbayUserinfo(user);
this.user=this.userinfoDao.getUserById("306");
System.out.println(this.user.getUName());
this.ebayBuygoods.setEbayUserinfo(user);
this.buygoodsDao.addBuyinglead(this.ebayBuygoods);
System.out.println(this.ebayBuygoods.getBContent());
System.out.println(this.ebayBuygoods.getBName());
return "add";
}
public String previous(){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String s_date=String.valueOf(sdf.format(new Date()));
String Sname=this.getBranchdirectory();
this.ebaySortinfo= this.sortinfoDao.getSortsBySname(Sname);
// System.out.println(this.ebaySortinfo.getSId());
// System.out.println(this.ebayBuygoods.getBContent());
this.ebayBuygoods.setEbaySortinfo(ebaySortinfo);
this.user=this.userinfoDao.getUserById("306");
this.ebayBuygoods.setEbayUserinfo(user);
// System.out.println(Sname);
this.ebayBuygoods.setCreatetime(s_date);
this.ebayBuygoods.setBEndtime(Nextmonth.getNextMonth(s_date));
this.ebayBuygoods.setBAble("1");
this.setEbayBuygoods(this.ebayBuygoods);
return "previous";
}
去掉红色的代码,先执行预览,然后执行添加,数据还会添加到数据库中,值得一提的是红色部分的数据会一直保存在该页面上...
页面的代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的 Ebay——商品发布</title>
</head>
<link rel="stylesheet" type="text/css" href="styles.css">
<script language="JavaScript" type="text/javascript">
var branchdirectory=[
["电脑","MP3","MP4","相机"],
["经济","文学","证劵","小说"],
["防晒霜","洗面奶","沐浴露","洗发水"],
["男装","女装","童装","内衣"],
["皮鞋","波鞋","沙滩鞋","布鞋"]
];
//alert(branchdirectory.length);
function getBranchdirectory(){
var sltMaindirectory=document.forms["loginfrm"].elements["Maindirectory"];
//alert(sltMaindirectory.length);
var sltBranchdirectory=document.forms["loginfrm"].elements["Branchdirectory"];
//alert(sltMaindirectory.selectedIndex);
var maindirectory=branchdirectory[sltMaindirectory.selectedIndex-1];
sltBranchdirectory.length=1;
for (var i=0;i<maindirectory.length; i++ )
{sltBranchdirectory[i+1]=new Option(maindirectory[i],maindirectory[i]);
}
}
function previous(){
var branchdirectory=document.getElementById("Branchdirectory").value;
location.href="previousMyGood.action?branchdirectory="+branchdirectory;
}
</script>
<body>
<!--<form method="post" action="addBuygoods.action" name="loginfrm"> -->
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="800" rowspan="2"><img src="image/logo.gif" width="170" height="44" /></td>
<td width="630" align="right"><a
href="#"> 买东西 </a>|<a
href="#"> 卖东西 </a>|<a
href="#"> 我的Ebay</a> |<a
href="#"> 逛商店</a></td>
</tr>
<tr >
<td align="right">您好 <span class="STYLE4 STYLE2">☺</span> Daniel 退出
</td>
</tr>
<br>
<table width="960" border="0" height="40px" cellspacing="0" cellpadding="0" align="center" background="image/logon_02.gif" >
<tr>
<td width="253" > </td>
<td width="222" > <select name="">
<option value="出售信息">出售信息</option>
<option value="求购信息">求购信息</option>
</select>
<input name="textfield" type="text" size="20" class="text"/></td>
<td width="288" >
<input type="submit" name="Submit" value="搜 索" class="btn"/>
</td>
<td width="197" > </td>
</tr>
</table>
<br>
<tr>
<td width="148"><TABLE width="800" border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD width="160" vAlign=top id=leftCol>
<TABLE width="148" cellPadding=0 cellSpacing=0 class=helpnav>
<TR>
<TD width="148" height="26px" background="image/bg_01.gif" >
<font color="#FFFFFF" size="2"> 我是买家</font>
</TD>
</TR>
<TR>
<TD class=category>
<UL>
<LI ><A
href="myBoughtGoodList.action">我购买的商品</A>
<LI ><A
href="listBuyGoods.action">我的求购信息</A>
<LI ><A
href="buyinglead.jsp">发布求购信息</A>
</UL>
</td></tr>
<TR>
<TD height="26px" background="image/bg_01.gif">
<font color="#FFFFFF" size="2"> 我是卖家</font>
</TD></TR>
<TR>
<TD class=category>
<UL>
<LI >
<A href="SaledPro.html">已经卖出的商品</A>
<LI >
<A href="AuctionPro.html">出售中的商品</A>
<LI >
<A href="StoreHousePro.html">仓库里的商品</A>
<LI
><A style="COLOR: #ff6600" href="SalingPro.html">商品发布</A>
</UL>
</td></tr>
<TR>
<TD height="26px" background="image/logon01.gif">
<font color="#FFFFFF" size="2"> 个人设定</font>
</TD></TR>
<TR>
<TD class=category>
<UL>
<LI ><A
href="">个人信息修改</A>
</TD>
</TR>
</TABLE></td>
<td width="661" valign="top"><table width="640" border="0" height="28" cellspacing="0" cellpadding="0" align="right">
<tr>
</tr>
<tr>
<td colspan="2"><table width="640" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<s:form method="post" action="buygoods.action" name="loginfrm" target="_blank">
<table width="640" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td colspan="2" background="image/table_02.gif" height="28"> <strong>商品发布</strong></td>
</tr>
<tr>
<td width="158" align="right">商品名称 </td>
<td width="476"> <input name="ebayBuygoods.BName" type="text" size="28" maxlength="30" class="text"/></td>
</tr>
<tr>
<td align="right">商品种类 </td>
<td> <select name="Maindirectory" onchange="getBranchdirectory()">
<option value="" >--请选择一个分类--</option>
<option value="264">数码</option>
<option value="Reading Material">阅读书籍</option>
<option value="Cosmetic">化妆品</option>
<option value="263">服装</option>
<option value="Shoses">鞋类</option>
</select>
<select name="Branchdirectory">
<option value="0"> --请选择--</option>
</select>
</td>
</tr>
<tr>
<td align="right">商品价格 </td>
<td> <input name="ebayBuygoods.BPrice" type="text" size="28" maxlength="30" class="text"/></td>
</tr>
<tr>
<td align="right">数量 </td>
<td> <input name="ebayBuygoods.BQuantity" type="text" size="28" maxlength="30" class="text"/></td>
</tr>
<tr>
<td align="right">商品描述 </td>
<td> <textarea name="ebayBuygoods.BContent" cols="10" rows="4" class="text"></textarea></td>
</tr>
</table>
<!-- <table width="640" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="提 交" /> <input name="name2" type="button" value="预 览" onclick="javascript:previous();"/> <a href="#"><input type="button" value="返 回" /></a></td>
</tr>
</table> -->
<table width="640" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="center"><s:submit value="提 交" method="add"/> <s:submit value="预 览" method="previous"/> </td><td><input type="reset" value="重设"/></td>
</tr>
</table>
</s:form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<hr align="center" width="800" />
<center> Copyright ©武汉大工尹科技发展有限公司. All Rights Reserved </center>
</body>
</html>
2)在呈现预览功能时最好是action 或者页面直接传值。建立一个简单的Viewbean也能解决此问题,但是的注意如果是同过get set方法取值的时候,数据会自动的set到取值的页面,影响下一步的操作;
3)代码:
public String add(){
//去掉这句执行语句红色部分?是否可以直接在此处进行对象的添加
String sName=this.getBranchdirectory();
this.ebaySortinfo= this.sortinfoDao.getSortsBySname(sName);
this.ebayBuygoods.setEbaySortinfo(ebaySortinfo);
// EbayUserinfo user=(EbayUserinfo)session.get();
// this.ebayBuygoods.setEbayUserinfo(user);
this.user=this.userinfoDao.getUserById("306");
System.out.println(this.user.getUName());
this.ebayBuygoods.setEbayUserinfo(user);
this.buygoodsDao.addBuyinglead(this.ebayBuygoods);
System.out.println(this.ebayBuygoods.getBContent());
System.out.println(this.ebayBuygoods.getBName());
return "add";
}
public String previous(){
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String s_date=String.valueOf(sdf.format(new Date()));
String Sname=this.getBranchdirectory();
this.ebaySortinfo= this.sortinfoDao.getSortsBySname(Sname);
// System.out.println(this.ebaySortinfo.getSId());
// System.out.println(this.ebayBuygoods.getBContent());
this.ebayBuygoods.setEbaySortinfo(ebaySortinfo);
this.user=this.userinfoDao.getUserById("306");
this.ebayBuygoods.setEbayUserinfo(user);
// System.out.println(Sname);
this.ebayBuygoods.setCreatetime(s_date);
this.ebayBuygoods.setBEndtime(Nextmonth.getNextMonth(s_date));
this.ebayBuygoods.setBAble("1");
this.setEbayBuygoods(this.ebayBuygoods);
return "previous";
}
去掉红色的代码,先执行预览,然后执行添加,数据还会添加到数据库中,值得一提的是红色部分的数据会一直保存在该页面上...
页面的代码如下:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的 Ebay——商品发布</title>
</head>
<link rel="stylesheet" type="text/css" href="styles.css">
<script language="JavaScript" type="text/javascript">
var branchdirectory=[
["电脑","MP3","MP4","相机"],
["经济","文学","证劵","小说"],
["防晒霜","洗面奶","沐浴露","洗发水"],
["男装","女装","童装","内衣"],
["皮鞋","波鞋","沙滩鞋","布鞋"]
];
//alert(branchdirectory.length);
function getBranchdirectory(){
var sltMaindirectory=document.forms["loginfrm"].elements["Maindirectory"];
//alert(sltMaindirectory.length);
var sltBranchdirectory=document.forms["loginfrm"].elements["Branchdirectory"];
//alert(sltMaindirectory.selectedIndex);
var maindirectory=branchdirectory[sltMaindirectory.selectedIndex-1];
sltBranchdirectory.length=1;
for (var i=0;i<maindirectory.length; i++ )
{sltBranchdirectory[i+1]=new Option(maindirectory[i],maindirectory[i]);
}
}
function previous(){
var branchdirectory=document.getElementById("Branchdirectory").value;
location.href="previousMyGood.action?branchdirectory="+branchdirectory;
}
</script>
<body>
<!--<form method="post" action="addBuygoods.action" name="loginfrm"> -->
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="800" rowspan="2"><img src="image/logo.gif" width="170" height="44" /></td>
<td width="630" align="right"><a
href="#"> 买东西 </a>|<a
href="#"> 卖东西 </a>|<a
href="#"> 我的Ebay</a> |<a
href="#"> 逛商店</a></td>
</tr>
<tr >
<td align="right">您好 <span class="STYLE4 STYLE2">☺</span> Daniel 退出
</td>
</tr>
<br>
<table width="960" border="0" height="40px" cellspacing="0" cellpadding="0" align="center" background="image/logon_02.gif" >
<tr>
<td width="253" > </td>
<td width="222" > <select name="">
<option value="出售信息">出售信息</option>
<option value="求购信息">求购信息</option>
</select>
<input name="textfield" type="text" size="20" class="text"/></td>
<td width="288" >
<input type="submit" name="Submit" value="搜 索" class="btn"/>
</td>
<td width="197" > </td>
</tr>
</table>
<br>
<tr>
<td width="148"><TABLE width="800" border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD width="160" vAlign=top id=leftCol>
<TABLE width="148" cellPadding=0 cellSpacing=0 class=helpnav>
<TR>
<TD width="148" height="26px" background="image/bg_01.gif" >
<font color="#FFFFFF" size="2"> 我是买家</font>
</TD>
</TR>
<TR>
<TD class=category>
<UL>
<LI ><A
href="myBoughtGoodList.action">我购买的商品</A>
<LI ><A
href="listBuyGoods.action">我的求购信息</A>
<LI ><A
href="buyinglead.jsp">发布求购信息</A>
</UL>
</td></tr>
<TR>
<TD height="26px" background="image/bg_01.gif">
<font color="#FFFFFF" size="2"> 我是卖家</font>
</TD></TR>
<TR>
<TD class=category>
<UL>
<LI >
<A href="SaledPro.html">已经卖出的商品</A>
<LI >
<A href="AuctionPro.html">出售中的商品</A>
<LI >
<A href="StoreHousePro.html">仓库里的商品</A>
<LI
><A style="COLOR: #ff6600" href="SalingPro.html">商品发布</A>
</UL>
</td></tr>
<TR>
<TD height="26px" background="image/logon01.gif">
<font color="#FFFFFF" size="2"> 个人设定</font>
</TD></TR>
<TR>
<TD class=category>
<UL>
<LI ><A
href="">个人信息修改</A>
</TD>
</TR>
</TABLE></td>
<td width="661" valign="top"><table width="640" border="0" height="28" cellspacing="0" cellpadding="0" align="right">
<tr>
</tr>
<tr>
<td colspan="2"><table width="640" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<s:form method="post" action="buygoods.action" name="loginfrm" target="_blank">
<table width="640" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr>
<td colspan="2" background="image/table_02.gif" height="28"> <strong>商品发布</strong></td>
</tr>
<tr>
<td width="158" align="right">商品名称 </td>
<td width="476"> <input name="ebayBuygoods.BName" type="text" size="28" maxlength="30" class="text"/></td>
</tr>
<tr>
<td align="right">商品种类 </td>
<td> <select name="Maindirectory" onchange="getBranchdirectory()">
<option value="" >--请选择一个分类--</option>
<option value="264">数码</option>
<option value="Reading Material">阅读书籍</option>
<option value="Cosmetic">化妆品</option>
<option value="263">服装</option>
<option value="Shoses">鞋类</option>
</select>
<select name="Branchdirectory">
<option value="0"> --请选择--</option>
</select>
</td>
</tr>
<tr>
<td align="right">商品价格 </td>
<td> <input name="ebayBuygoods.BPrice" type="text" size="28" maxlength="30" class="text"/></td>
</tr>
<tr>
<td align="right">数量 </td>
<td> <input name="ebayBuygoods.BQuantity" type="text" size="28" maxlength="30" class="text"/></td>
</tr>
<tr>
<td align="right">商品描述 </td>
<td> <textarea name="ebayBuygoods.BContent" cols="10" rows="4" class="text"></textarea></td>
</tr>
</table>
<!-- <table width="640" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="提 交" /> <input name="name2" type="button" value="预 览" onclick="javascript:previous();"/> <a href="#"><input type="button" value="返 回" /></a></td>
</tr>
</table> -->
<table width="640" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td align="center"><s:submit value="提 交" method="add"/> <s:submit value="预 览" method="previous"/> </td><td><input type="reset" value="重设"/></td>
</tr>
</table>
</s:form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<hr align="center" width="800" />
<center> Copyright ©武汉大工尹科技发展有限公司. All Rights Reserved </center>
</body>
</html>
发表评论
-
(SSH框架)Spring 和Struts的配置说明...
2011-06-28 11:32 1594Struts2的配置: <?xml version=& ... -
提问:为什么在Operate这个方法中运行后,X的值改变,但Y没有?
2011-06-14 18:36 1341代码: package test; public c ... -
(Linux)Vi的常用命令的整理
2011-06-07 11:36 1622Vi is short for Visualedit... ... -
(Ajax) Ajax的运行轨迹
2011-06-04 21:47 963一段Ajax的代码 function check ... -
(Spring&Hibernate )Spring & Hibernate的整合分页问题之二:代码解析和逻辑关系
2011-06-04 16:27 1280总所周知,JavaEE软件开发三层构架分别是:显示层(JSP页 ... -
(Spring&Hibernate )Spring & Hibernate的整合分页问题之一:代码部分
2011-06-04 15:28 929list.jsp的分页跳转的代码: <tr alig ... -
(笔记)如何在java中调用procedure & function
2011-05-27 10:17 6506第一:调用函数的例子: package daniel.tes ... -
有关日期Date 和String型相互转换
2011-05-20 16:49 1004SimpleDateFormat sdf=new Simple ... -
(笔记)HashCode() 和Equals()对比代码之2
2011-05-19 16:31 910package Hash; public class Dem ... -
(笔记)HashCode() 和Equals()对比代码之1
2011-05-19 16:27 761package Hash; public class Dem ... -
(笔记)J2EE中的同步和异步
2011-05-18 19:10 953在学习java过程中很多人对同步(Synchronized)和 ... -
(笔记)有关thread的相关知识之2---运行顺序
2011-05-18 16:29 2861example1: package Thread; publi ... -
(笔记)有关thread的相关知识理解1
2011-05-18 16:21 2863-------Thread------ 线程(Thread)是 ... -
(笔记) Struts 中PassValue 的代码实现
2011-05-17 19:13 944--Struts的配置-- <struts> ... -
在同一Form表单中双Submit的传值和预览
2011-05-17 18:03 2861-- 引入C&S标签-- <%@ taglib ... -
笔记temp
2011-05-13 12:02 681在什么情况下需要lazy loading 对象调用对象的属性 ... -
ssh+tomcat+myeclipse6.5配置项目时异常
2011-05-10 16:05 959在利用框架设计时注意: 先配置 Hibernate 然后配置S ... -
SHH框架下Struts的配置
2011-05-10 16:00 1002SHH框架下Struts的配置 Struts的配置: 先导 ... -
SHH框架下Spring的配置
2011-05-10 15:43 950SHH框架下Spring的配置: ---MyEclipse- ... -
SHH框架下Hibernater的配置
2011-05-10 15:19 1127Hibernate的配置 首先已经通过MyEclipse D ...
相关推荐
6发布1.1.1版本GitHub 添加上拉加载更多功能GitHub 添加搜索功能添加检查更新和个人主页功能修复登录后主页不刷新的bug2017-5-3发布1.1.0版本修复Android 4.3 及以下版本备份到SD卡失败的bug添加分享App功能添加...
总结起来,这篇笔记提供了cocos2dx_lua开发中的一些基础和进阶操作,对于使用这个引擎进行游戏开发的人员来说,尤其是一些解决隐蔽bug的方法,具有很高的参考价值。通过学习和理解这些笔记,开发者能够更好地理解和...
### LotusDomino学习笔记知识点概览 #### 1. 选取视图的列的内容 (@Trim @DbColumn) - **@Trim**: 是一个内置的LotusScript函数,用于去除字符串两端的空白字符。 - **@DbColumn**: 此函数用于获取指定列的信息。...
刷新BIOS可以添加相应的模块,确保硬件得到正确识别和使用。 3. **性能提升**:通过优化硬件使用和修复硬件工作异常的BUG,刷新BIOS可以显著提升系统性能,尤其是在台式机中,例如提高超频能力。 4. **功能增强**...
08、关于作者页面添加:头像设置、暧昧短信栏目 09、新增网友诗集并更新部分网友留言 10、修复输入法设置一个小BUG 11、<韵脚大全>页面添加“自行输入韵母”查询功能 2011.10.15 【v2.9】 01、...
8. **AJAX异步通信**:为了提升用户体验,FexBook可能利用JavaScript(可能结合jQuery库)和XMLHttpRequest对象实现了部分页面的异步更新,减少不必要的页面刷新。 9. **错误日志与调试**:为了追踪和修复问题,...
在安装最新版本为知笔记客户端之后,可以选择直接将数据保存到本地,也可以有更多地保存功能。 2012-09-01 1. 无需安装客户端即可使用,在线保存,直接保存到云端 2. 支持剪辑模式的选择 3. 支持windows、mac、linux...
- SpringBoot拦截器:使用`@Configuration`和`WebMvcConfigurerAdapter`,重写`addInterceptors`方法添加拦截器。 - 定时任务:通过`@EnableScheduling`开启,配合`@Component`、`@Async`和`@Scheduled`注解实现...
3. **Ajax与Fetch API**:用于在不刷新整个页面的情况下从服务器获取数据,这对于实时更新或异步通信至关重要。在现代JavaScript中,Fetch API逐渐取代了传统的Ajax。 4. **事件监听与处理**:通过JavaScript,我们...