jsp源码jsp 中网站的首页源代码

jsp源码  时间:2021-09-02  阅读:()

java web求实现jsp代码

①通过js获取选中复选框的值 var obj = document.getElementsByName("fxk"); var str = ""; for(var i = 0 ;i<obj.length;i++) { if(obj[i].checked) str += obj[i].value + ","; } str = str.replace(/,$/,""); //去掉最后一个逗号 ②赋值给表单,提交表单 document.getElementById("fxk_value").value = str; //fxk_value赋值给表单中的文本框,这个文本框你可以改成隐藏的! form1.submit(); //根据表单name提交表单 …… <form id="form1" name="form1" method="post" action="填写你自己的提交地址"> <input type="text" id="fxk_value"> </form>

JSP 源代码编写 表单操作

<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%> <html> ? <body> <form action="" method="post"> 第一个操作数:<input type="text" name="one"><br> 运算符:<select name="op"> <option value="+">+</option> <option value="-">-</option> <option value="*">*</option> <option value="/">/</option> </select><br> 第二个操作数:<input type="text" name="two"><br> <input type="submit" value="提交">? </form> <hr> <% int ones=0; int twos=0; double threes=0.0; String one=request.getParameter("one"); ones=Integer.parseInt(one); String op=request.getParameter("op"); String two=request.getParameter("two"); twos=Integer.parseInt(two); out.println(ones); out.println(op); out.println(twos); out.println("="); if(op=="+") { ?threes=(double)ones+twos; ?out.println(threes); } else if(op.equals("-")) { threes=(double)ones-twos; out.println(threes); } else if (op.equals("/")) { if(twos!=0) { threes=(double)ones/twos; out.println(threes); } else out.println("输入的数据有误"); } else { threes=(double)ones*twos; out.println(threes); } ?%> ? </body> </html>

jsp 中网站的首页源代码

这是最简单的一个例子,数据库要你自己建,用的是ACCESS <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>JSP连接ess数据库</title> <style type="text/css"> <!-- .style1 { font-size: 20px; font-weight: bold; } --> </style> </head><body> <div align="center" class="style1">JSP连接ess数据库</div> <br> <hr> <p><% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //载入驱动程序类别 Connection con = DriverManager.getConnection("jdbc:odbc:jspdata"); //建立数据库链接,jspdata为ODBC数据源名称 //建立Statement对象 Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stmt.executeQuery("select * from lyb"); //建立ResultSet(结果集)对象,并执行SQL语句 %> </p> <p align="center">NUMB1数据表中记录如下</p> <table width="640" border="1" align="center" bordercolor="#7188e0"> <tr bgcolor="d1d1ff"> <th width="49">编号</th> <th width="90">姓名</th> <th width="126">E-mail</th> <th width="221">网站</th> <th width="80">QQ</th> </tr> <% while(rs.next()) { %> <tr bgcolor="#f8f8f8"> <th><%= rs.getString(1) %></th> <th><%= rs.getString(2) %></th> <th><%= rs.getString(3) %></th> <th bgcolor="#f6f6f8"><%= rs.getString(4) %></th> <th><%= rs.getString(5) %></th> </tr> <% } rs.close(); stmt.close(); con.close(); %> </table> <p align="center"><br> 如果您能看到表格中的数据,说明连接数据库成功!</p> </body> </html>

CloudCone:洛杉矶MC机房KVM月付1.99美元起,支持支付宝/PayPal

CloudCone是一家成立于2017年的国外VPS主机商,提供独立服务器租用和VPS主机,其中VPS基于KVM架构,多个不同系列,譬如常规VPS、大硬盘VPS等等,数据中心在洛杉矶MC机房。商家2021年Flash Sale活动继续,最低每月1.99美元,支持7天退款到账户,支持使用PayPal或者支付宝付款,先充值后下单的方式。下面列出几款VPS主机配置信息。CPU:1core内存:768MB...

ZJI(月付480元),香港阿里云专线服务器

ZJI是成立于2011年原Wordpress圈知名主机商—维翔主机,2018年9月更名为ZJI,主要提供香港、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册业务。本月商家针对香港阿里云线路独立服务器提供月付立减270-400元优惠码,优惠后香港独立服务器(阿里云专线)E3或者E5 CPU,SSD硬盘,最低每月仅480元起。阿里一型CPU:Intel E5-2630L...

香港2GB内存DIYVM2核(¥50月)香港沙田CN2云服务器

DiyVM 香港沙田机房,也是采用的CN2优化线路,目前也有入手且在使用中,我个人感觉如果中文业务需要用到的话虽然日本机房也是CN2,但是线路的稳定性不如香港机房,所以我们在这篇文章中亲测看看香港机房,然后对比之前看到的日本机房。香港机房的配置信息。CPU内存 硬盘带宽IP价格购买地址2核2G50G2M1¥50/月选择方案4核4G60G3M1¥100/月选择方案4核8G70G3M4¥200/月选择...

jsp源码为你推荐
推信怎么样才可以精准引流?网页图标网站ICO图标若想全部添加到网页中,有什么简便方法吗?什么是cookie覆盖自动cookie处理是什么意思4g上网卡什么是4G无线上网卡站内搜索引擎站内搜索与百度的搜索引擎有什么本质性的区别?哪些大数据公司提供站内搜索这种服务?硬盘分区格式化电脑进入系统硬盘分区及格式化,怎样操作?黑屏操作电脑在黑屏的情况怎么重新操作系统主板说明书主板各个接口,插口的详细说明我的电脑打开很慢电脑开机慢怎么办电脑速度慢怎么办我的电脑打开很慢电脑开机为什么总是那么慢啊?
asp主机 虚拟主机评测网 vps服务器 看国外视频直播vps qq空间域名 evssl证书 日本空间 中国特价网 世界测速 爱奇艺vip免费试用7天 申请网页 免费asp空间申请 可外链的相册 广州服务器托管 网站防护 hdsky 九零网络 免费的加速器 带宽测速 asp.net虚拟主机 更多