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

📄 diy_count.jsp

📁 JSP效果信息 各位请下载查看 比较不错的
💻 JSP
字号:
<%@page contentType="text/html;charset=gb2312" %>
<%
  try{
    String str_count=(String)session.getValue("count");
    if(str_count==null)
      str_count="0";
    int int_count=Integer.parseInt(str_count);
    out.println("<center><b>"+int_count+"</b></center><br>");
    int count=int_count%2;
    int_count=int_count+1;
    str_count=String.valueOf(int_count);
    session.putValue("count",str_count);
    if(count==0){
%>
<html>
  <head><title>DIY计算器</title></head>
  <body bgcolor="#FFFFFF">
   <center>
    <form action="DIY_Count.jsp" name="frm" method="post">
      <table>
       <tr>
         <td>CPU</td>
         <td>
           <select name="cpu">
             <option value="860">AMD Duron 700</option>
             <option value="800">Via Cyrix PR500</option>
             <option value="840">P4 500E</option>
           </select>
           <input type="hidden" name="860" value="AMD Duron 700">
           <input type="hidden" name="800" value="Via Cyrix PR500">
           <input type="hidden" name="840" value="P4 500E">
         </td>
       </tr>
       <td>主板</td>
       <td>
          <select name="zhb">
            <option value="650">MSI 845E</option>
            <option value="540">联想 845E</option>
            <option value="600">ABIT KT7</option>
          </select>
          <input type="hidden" name="650" value="MSI 845E">
          <input type="hidden" name="540" value="联想 845E">
          <input type="hidden" name="600" value="ABIT KT7">
       </td>
       </tr>
       <tr>
         <td>内存</td>
         <td>
           <select name="nc">
             <option value="300">PC133 512MB</option>
             <option value="270">PC133 256MB</option>
             <option value="248">PC133 128MB</option>
           </select>
           <input type="hidden" name="300" value="PC133 512MB">
           <input type="hidden" name="270" value="PC133 256MB">
           <input type="hidden" name="248" value="PC133 128MB">
         </td>
       </tr>
       <tr>
         <td>硬盘</td>
         <td>
          <select name="yp">
           <option value="580">Quantum 80G</option>
           <option value="490">IBM 40G</option>
           <option value="420">Maxtor 20G</option>
          </select>
          <input type="hidden" name="580" value="Quantum 80G">
          <input type="hidden" name="490" value="IBM 40G">
          <input type="hidden" name="420" value="Maxtor 20G">
         </td>
       </tr>
       <tr>
         <td>显示器</td>
         <td>
           <select name="xshq">
             <option value="900">Acer 78G</option>
             <option value="880">LG 795G</option>
             <option value="1000">Sony G200</option>
           </select>
           <input type="hidden" name="900" value="Acer 78G">
           <input type="hidden" name="880" value="LG 795G">
           <input type="hidden" name="1000" value="Sony G200">
         </td>
       </tr>
       <tr>
         <td>光驱</td>
         <td>
           <select name="gq">
             <option value="160">飞利普 80x</option>
             <option value="140">三星 80x</option>
             <option value="180">索尼 80x</option>
           </select>
           <input type="hidden" name="160" value="Philip 80x">
           <input type="hidden" name="140" value="Star 80x">
           <input type="hidden" name="180" value="Sony 80x">
         </td>
       </tr>
       <tr>
         <td>显卡</td>
         <td>
           <select name="xk">
             <option value="310">Matrox F450</option>
             <option value="340">Nvidia MX</option>
             <option value="300">Veedoo 5</option>
           </select>
           <input type="hidden" name="310" value="Matrox F450">
           <input type="hidden" name="340" value="Nvidia MX">
           <input type="hidden" name="300" value="Veedoo 5">
         </td>
       </tr>
       <tr>
       <td>声卡</td>
         <td>
           <select name="shk">
             <option value="120">SoundBlaster Live5.1</option>
             <option value="130">Diamond S200</option>
             <option value="140">Yamaha 744</option>
           </select>
           <input type="hidden" name="120" value="SoundBlaster Live5.1">
           <input type="hidden" name="130" value="Diamond S200">
           <input type="hidden" name="140" value="Yamaha 744">
         </td>
       </tr>
      </table>
      <input type="submit" name="submit" value="提交">
      <input type="reset" name="reset" value="取消">
    </form>
   </center>
  </body>
</html>
<%
  }else{
    String cpu=request.getParameter("cpu");
    String zhb=request.getParameter("zhb");
    String nc=request.getParameter("nc");
    String yp=request.getParameter("yp");
    String xshq=request.getParameter("xshq");
    String gq=request.getParameter("gq");
    String xk=request.getParameter("xk");
    String shk=request.getParameter("shk");
    String cpu_name=request.getParameter(cpu);
    String zhb_name=request.getParameter(zhb);
    String nc_name=request.getParameter(nc);
    String yp_name=request.getParameter(yp);
    String xshq_name=request.getParameter(xshq);
    String gq_name=request.getParameter(gq);
    String xk_name=request.getParameter(xk);
    String shk_name=request.getParameter(shk);
    int int_cpu=0;
    int int_zhb=0;
    int int_nc=0;
    int int_yp=0;
    int int_xshq=0;
    int int_gq=0;
    int int_xk=0;
    int int_shk=0;
    if(!cpu.equals(""))
      int_cpu=Integer.parseInt(cpu);
    if(!zhb.equals(""))
      int_zhb=Integer.parseInt(zhb);
    if(!nc.equals(""))
      int_nc=Integer.parseInt(nc);
    if(!yp.equals(""))
      int_yp=Integer.parseInt(yp);
    if(!xshq.equals(""))
      int_xshq=Integer.parseInt(xshq);
    if(!gq.equals(""))
      int_gq=Integer.parseInt(gq);
    if(!xk.equals(""))
      int_xk=Integer.parseInt(xk);
    if(!shk.equals(""))
      int_shk=Integer.parseInt(shk);
    int num=int_cpu+int_zhb+int_nc+int_yp+int_xshq+int_gq+int_xk+int_shk;
 %>
   <html>
     <body>
       <center>
         <table border="20">
           <tr>
            <td>CPU</td>
            <td><%=cpu_name %></td>
            <td><%=int_cpu %>元</td>
           </tr>
           <tr>
            <td>主板</td>
            <td><%=zhb_name %></td>
            <td><%=int_zhb %>元</td>
           </tr>
           <tr>
            <td>内存</td>
            <td><%=nc_name %></td>
            <td><%=int_nc %>元</td>
           </tr>
           <tr>
            <td>硬盘</td>
            <td><%=yp_name %></td>
            <td><%=int_yp %>元</td>
           </tr>
           <tr>
            <td>显示器</td>
            <td><%=xshq_name %></td>
            <td><%=int_xshq %>元</td>
           </tr>
           <tr>
            <td>光驱</td>
            <td><%=gq_name %></td>
            <td><%=int_gq %>元</td>
           </tr>
           <tr>
            <td>显卡</td>
            <td><%=xk_name %></td>
            <td><%=int_xk %>元</td>
           </tr>
           <tr>
            <td>声卡</td>
            <td><%=shk_name %></td>
            <td><%=int_shk %>元</td>
           </tr>
         </table>
         <p></p>
         您配置机器总价为<%=num%>元人民币<br>
         <a href="DIY_Count.jsp">如不满意,请点击这里重新选择!<a>
       </center>
     </body>
   </html>
 <%
    }
  }catch(Exception e){
    out.println(e.toString()+"<br>");
 %>
  您的输入是非法的!
  <a href="DIY_Count.jsp">请点击这里重新选择!</a>
  <%
  }
  %>

⌨️ 快捷键说明

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