web实验报告.docx

上传人:b****8 文档编号:9855915 上传时间:2023-02-07 格式:DOCX 页数:46 大小:194.09KB
下载 相关 举报
web实验报告.docx_第1页
第1页 / 共46页
web实验报告.docx_第2页
第2页 / 共46页
web实验报告.docx_第3页
第3页 / 共46页
web实验报告.docx_第4页
第4页 / 共46页
web实验报告.docx_第5页
第5页 / 共46页
点击查看更多>>
下载资源
资源描述

web实验报告.docx

《web实验报告.docx》由会员分享,可在线阅读,更多相关《web实验报告.docx(46页珍藏版)》请在冰豆网上搜索。

web实验报告.docx

web实验报告

安徽工业大学《web程序设计》实验报告

实验三~五

jsp页面代码

注册:

<%@pagelanguage="java"contentType="text/html;charset=UTF-8"

pageEncoding="UTF-8"%>

DOCTYPEhtml>

注册

登录注册

用户名

密码

确认密码

varvPsw=document.getElementById("password");

varvPsw2=document.getElementById("password2");

varp1=vPsw.value;

varp2=vPsw2.value;

functionregist(){

varusername=$("#username").val();

varpwd=$("#password").val();

varpwd2=$("#password2").val();

//alert("pwd"+pwd);

//alert("pwd2"+pwd2);

if(username==""||pwd==""){

alert("用户名或密码不能为空");

}elseif(pwd!

=pwd2){

alert("两次密码输入不一致");

}else{

vardataJson={"username":

username,"password":

pwd};

//alert(username+pwd);

$.ajax({

url:

"regist",

data:

dataJson,

type:

"post",

dataType:

"json",

success:

function(data){

//alert(data);

//alert(data);

varflag=data.flag;

//alert(flag);

if(flag=="-1"){

alert("用户名已经存在");

}elseif(flag=='1'){

alert("注册成功");

}

}

});

}

}

登录:

<%@pagelanguage="java"contentType="text/html;charset=UTF-8"

pageEncoding="UTF-8"%>

DOCTYPEhtml>

Inserttitlehere

 

--action代表了服务器端的处理程序-->

---->

<%

Stringflag=request.getParameter("flag");

System.out.println("flag"+flag);

if("out".equals(flag)){

session.setAttribute("username",null);

System.out.println("flag"+flag);

}

%>

登录注册

用户名

密码

登录

functionlogin(){

varusername=$("#account").val();

varpwd=$("#password").val();

vardataJson={"username":

username,"password":

pwd};

//alert("pwd"+pwd);

$.ajax({

url:

"login",

data:

dataJson,

type:

"post",

dataType:

"json",

success:

function(data){

//alert(data);

//alert(data);

varflag=data.flag;

//alert(flag);

if(flag=="-1"){

alert("用户名不存在");

}elseif(flag=='0'){

window.location.href="control.jsp?

username="+username;

}else{

alert("密码错误");

}

}

});

}

 

购物车:

<%@pagelanguage="java"contentType="text/html;charset=UTF-8"

pageEncoding="UTF-8"%>

<%@tagliburi="prefix="c"%>

<%@taglibprefix="fmt"uri="%>

DOCTYPEhtml>

Inserttitlehere

返回继续购物

  • 全选
  • 商品名称

    总价

    单价

    数量

    操作

    forEachitems="${cartList}"var="cart">

  • ${cart.name}-${cart.id}

    formatNumbervalue="${cart.totalPrice}"type="currency"/>

    formatNumbervalue="${cart.price}"type="currency"/>

    productId=${cart.productId}">-

    productId=${cart.productId}">+

    productId=${cart.id}">删除

    forEach>

    --

    forEachvar="cart"items="${cartList}">


    ${cart.name}

    ${cart.price}元

    ${cart.count}份

    forEach>

    -->

    电商主页:

    <%@pageimport="java.util.List"%>

    <%@pagelanguage="java"contentType="text/html;charset=UTF-8"

    pageEncoding="UTF-8"%>

    <%@tagliburi="prefix="c"%>

    <%@taglibprefix="fmt"uri="%>

    DOCTYPEhtml>

    每日生鲜,天天放心

    varvTimer=setInterval(function(){

    vartitle=document.title;

    varbegin=title.substr(0,1);

    varend=title.substr(1,title.length);

    document.title=end+begin;

    },1000)

    *{

    font-family:

    微软雅黑;

    }

    ulli{

    text-decoration:

    none;

    }

    .list-content{

    width:

    1200px;

    height:

    300px;

    }

    .list-contentulliimg{

    width:

    120px;

    height:

    144px;

    }

    .list-contentulli{

    width:

    248px;

    height:

    298px;

    text-align:

    center;

    list-style:

    none;

    border:

    1pxsolid#ededed;

    float:

    left;

    }

    .list-contentulli:

    hover{

    opacity:

    0.7;

    }

    .list-contentullih3{

    color:

    #43A200;

    }

    .list-contentullih4{

    margin-top:

    5px;

    }

    .desc{

    color:

    silver;

    }

    .shopcart{

    //position:

    relative;

    margin-top:

    -5px;

    }

    <%

    Stringusername=request.getParameter("username");

    if(username==null){

    username=(String)session.getAttribute("username");

    }

    session.setAttribute("username",username);

    %>

    欢迎

    iftest="${username!

    =null}">

    <%=username%>

    if>

    来到¥19.9生鲜商城

    我的购物车

    全部商品分类

  • 首页     |
  • 速冻食品     |
  • 禽类蛋品     |
  • 新鲜水果     |
  • 猪牛羊肉     |
  • 新鲜蔬菜     |
  • 海鲜水产     
  • 展开阅读全文
    相关资源
    猜你喜欢
    相关搜索
    资源标签

    当前位置:首页 > 工程科技 > 纺织轻工业

    copyright@ 2008-2022 冰豆网网站版权所有

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