书签 分享 收藏 举报 版权申诉 / 21

类型校园小商品交易系统设计与实现.docx

  • 文档编号:3451137
  • 上传时间:2022-11-23
  • 格式:DOCX
  • 页数:21
  • 大小:276.55KB

商城

找商品

最近更新

热门商品


 

数据库的连接,注册部分

<%booleanboo=false;

Stringm="";

if(suserid.getSname()==null)

{

m="请输入用户名";

boo=false;

}

if(suserid.getSname()!

=null)

{

Connectioncon=null;

try{

Class.forName("oracle.jdbc.driver.OracleDriver");

}

catch(ClassNotFoundExceptione){}

try

{

con=DriverManager.getConnection("jdbc:

odbc:

suser","suser","suser");

Stringstr="insertintosuservalues(?

?

?

?

)";

PreparedStatementpstmt=con.prepareStatement(str);

pstmt.setString(1,suserid.getSname());

pstmt.setString(2,suserid.getSname());

pstmt.setString(3,suserid.getPhone());

pstmt.setString(4,suserid.getEmail());

pstmt.execute();

pstmt.close();

con.close();

m="用户注册成功";

boo=true;

}

catch(Exceptione1)

{

m="插入数据时出错";

boo=false;

}

}

%>

 

登陆部分

<%Stringm="";

booleanbo=false;

Connectioncon=null;

Statementstmt=null;

ResultSetrs=null;

if(pdl.getPname()==null)

{

m="请输入用户名";

bo=false;

}

else

{

try{

Class.forName("oracle.jdbc.driver.OracleDriver");

}

catch(ClassNotFoundExceptione){}

try

{

con=DriverManager.getConnection("jdbc:

odbc:

puser","puser","puser");

Stringstr="selectpname,ppasswordfrompuser";

stmt=con.createStatement();

rs=stmt.executeQuery(str);

while(rs.next())

{

Stringn1=rs.getString

(1).trim();

Stringp1=rs.getString

(2).trim();

if(n1.equals(pdl.getPname())&&p1.equals(pdl.getPpassword()))

{

m="登陆成功";

bo=true;

}

}

rs.close();

stmt.close();

con.close();

}

catch(SQLExceptione)

{m="登陆失败,请重新登陆";

bo=false;}

}

%>

 

密码修改部分

<%@pagecontentType="text/html;Charset=GB2312"%>

<%@pageimport="java.sql.*"%>

useBeanid="pc"class="shitu.pbean.Pc"scope="request"/>

setPropertyname="pc"property="*"/>

<%Stringm=null;

Stringpassword=pc.getPassword();

Stringname=(String)session.getAttribute("dquser");

Stringpassword1=pc.getPassword1();

Connectioncon=null;

if(pc.getPassword()==null)

{

session.setAttribute("m","请输入密码");

response.sendRedirect("pgl.jsp");

}

if(pc.getPassword().equals(pc.getPassword1())&&pc.getPassword()!

=null&&pc.getPassword1()!

=null)

{

try{

Class.forName("oracle.jdbc.driver.OracleDriver");

}

catch(ClassNotFoundExceptione){}

try

{

con=DriverManager.getConnection("jdbc:

odbc:

puser","puser","puser");

Stringstr="updatepusersetppassword=?

wherepname=?

";

PreparedStatementstmt=con.prepareStatement(str);

stmt.setString(1,pc.getPassword());

stmt.setString(2,name);

stmt.execute();

stmt.close();

con.close();

session.setAttribute("m","修改成功");

response.sendRedirect("pgl.jsp");

}

catch(SQLExceptione)

{out.print(e);

session.setAttribute("m","插入数据库出错");

response.sendRedirect("pgl.jsp");

}

}

else{session.setAttribute("m","前后两次密码不对");

response.sendRedirect("pgl.jsp");}

%>

 

按价格区域搜索商品部分

<%Connectioncon=null;

intid=0;

try{

Class.forName("oracle.jdbc.driver.OracleDriver");

}

catch(ClassNotFoundExceptione){}

try

{

Stringdi=request.getParameter("zuidi");

intzuidi=Integer.parseInt(di);

Stringgao=request.getParameter("zuigao");

intzuigao=Integer.parseInt(gao);

con=DriverManager.getConnection("jdbc:

odbc:

fangke","fangke","fangke");

Stringstr="selectsuser.suser.sname,suser.suser.phone,suser.sp.spid,suser.sp.spname,suser.sp.jiage,suser.sp.guanggaocifromsuser.sp,suser.suserwheresuser.suser.sname=suser.sp.snameandsuser.sp.jiage>="+zuidi+"andsuser.sp.jiage<="+zuigao;

Statementstm=con.createStatement();

ResultSetsrs=stm.executeQuery(str);

//stm.setInt(1,id);

out.print("");

out.print("");

out.print(""+"卖家"+"");

out.print(""+"卖家电话"+"");

out.print(""+"商品id"+"");

out.print(""+"商品名称"+"");

out.print(""+"商品价格"+"");

out.print(""+"广告词"+"");

out.print("");

while(srs.next())

{out.print("");

Stringna=srs.getString

(1);

out.print(""+na+"");

Stringdianhua=srs.getString

(2);

out.print(""+dianhua+"");

intn=srs.getInt(3);

out.print(""+n+"");

Stringb=srs.getString(4);

out.print(""+b+"");

intc=srs.getInt(5);

out.print(""+c+"");

Stringj=srs.getString(6);

out.print(""+j+"");

out.print("");

}

out.print("");

con.close();

}

举报
举报
版权申诉
版权申诉
word格式文档无特别注明外均可编辑修改;预览文档经过压缩,下载后原文更清晰! 立即下载
配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
校园 小商品 交易系统 设计 实现
提示  冰豆网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:校园小商品交易系统设计与实现.docx
链接地址:https://www.bdocx.com/doc/3451137.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2022 冰点文档网站版权所有

经营许可证编号:鄂ICP备2022015515号-1

收起
展开