⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch3-2b.jsp

📁 关于jsp方向的seesion代码和cookie代码
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head><title>购买商品-读取Session</title></head>
<body bgcolor="#FFFFcc">	
<%
String  name1,jiage1,name2,jiage2,name3,jiage3,name4,jiage4;
 name1=(String)session.getValue("name1");
jiage1=(String)session.getValue("jiage1");
 name2=(String)session.getValue("name2");
jiage2=(String)session.getValue("jiage2");
 name3=(String)session.getValue("name3");
jiage3=(String)session.getValue("jiage3");
 name4=(String)session.getValue("name4");
jiage4=(String)session.getValue("jiage4");
float jg1,jg2,jg3,jg4,jgz;
jg1=Float.parseFloat(jiage1);
jg2=Float.parseFloat(jiage2);
jg3=Float.parseFloat(jiage3);
jg4=Float.parseFloat(jiage4);
if (name1==null)
   {name1="";
   jiage1="";
   jg1=0;}
if (name2==null)
   {name2="";
   jiage2="";
   jg2=0;}
if (name3==null)
   {name3="";
   jiage3="";
   jg3=0;}
if (name4==null)
   {name4="";
   jiage4="";
   jg4=0;}
jgz=jg1+jg2+jg3+jg4;
%>
<p class="style1">你购买的文具如下:</p>
<table width="384" border="1" cellspacing="0" bordercolor="#FF66CC">
  <tr>
    <th width="176" scope="row">商 品</th>
    <th width="198">价 格</th>
  </tr>
  <tr>
    <td scope="row">&nbsp;&nbsp;<%=name1%>&nbsp;</td>
    <td><%=jiage1%></td>
  </tr>
  <tr>
    <td scope="row">&nbsp;&nbsp;<%=name2%></td>
    <td><%=jiage2%></td>
  </tr>
  <tr>
    <td scope="row">&nbsp;&nbsp;<%=name3%></td>
    <td><%=jiage3%></td>
  </tr>
  <tr>
    <td scope="row">&nbsp;&nbsp;<%=name4%></td>
    <td><%=jiage4%></td>
  </tr>
  <tr>
    <th scope="row">金 额</th>
    <td><%=jgz%></td>
  </tr>
</table>
<p><a href="ch3-2.htm">返回购物</a></p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -