jsp网站源码求jsp网页代码@@用户登录--注册--(要连接数据库的哦)

jsp网站源码  时间:2021-09-13  阅读:()

用jsp做一个网站的代码怎么写?

最简单的就是 <%out.print("这是一个网站")%> 其实,你的这个问题太笼统了。

要坐网站的话,要掌握html css ,还有javascript或者vbscript 然后是java或者php或者其他的。







首先也得知道 要做怎么样的网站啊。





哪位可以提供JSP的网站计数器的源代码?一定要没有错误可以运行的哟!!不胜感激!!

jsp计数器程序段: //test.jsp文件 <%@ page contentType="text/html;charset=gb2312"%> <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <TITLE>计数器演示程序</TITLE> </HEAD> <BODY> <!--创建并调用bean(counter)--> <jsp:useBean id="counter" class="counter" scope="request"> </jsp:useBean> <% //调用counter对象的ReadFile方法来读取文件lyfcount.txt中的计数 String cont=counter.ReadFile("/lyfcount.txt"); //调用counter对象的ReadFile方法来将计数器加一后写入到文件lyfcount.txt中 counter.WriteFile("/lyfcount.txt",cont);%> 您是第<font color="red"><%=cont%></font>位访问者 </BODY> </HTML> //counter.java 读写文件的一个bean import java.io.*; public class counter extends Object { private String currentRecord = null;//保存文本的变量 private BufferedReader file; //BufferedReader对象,用于读取文件数据 private String path;//文件完整路径名 public counter() { } //ReadFile方法用来读取文件filePath中的数据,并返回这个数据 public String ReadFile(String filePath) throws FileNotFoundException { path = filePath; //创建新的BufferedReader对象 file = new BufferedReader(new FileReader(path)); String returnStr =null; try { //读取一行数据并保存到currentRecord变量中 currentRecord = file.readLine(); } catch (IOException e) {//错误处理 System.out.println("读取数据错误."); } if (currentRecord == null) //如果文件为空 returnStr = "没有任何记录"; else {//文件不为空 returnStr =currentRecord; } //返回读取文件的数据 return returnStr; } //ReadFile方法用来将数据counter+1后写入到文本文件filePath中 //以实现计数增长的功能 public void WriteFile(String filePath,String counter) throws FileNotFoundException { path = filePath; //将counter转换为int类型并加一 int Writestr = Integer.parseInt(counter)+1; try { //创建PrintWriter对象,用于写入数据到文件中 PrintWriter pw = new PrintWriter(new FileOutputStream(filePath)); //用文本格式打印整数Writestr pw.println(Writestr); //清除PrintWriter对象 pw.close(); } catch(IOException e) { //错误处理 System.out.println("写入文件错误"+e.getMessage()); } } } 到这里,程序写完了,将counter.java编译为counter.class,同样放在对应的class目录下,在根目录下建立一个lyfcount.txt文件,文件内容就一个数字0,直接在浏览器中敲入地址就可以看到计数器了,刷新浏览器会看到不断变幻的数字。

(如果运行时候提示找不到文件,请将上面test.jsp中的readfile那一句注释后运行一次则lyfcount.txt文件自动建立,然后就可以正常运行。

)

求jsp网页代码@@用户登录--注册--(要连接数据库的哦)

<%@ page contentType="text/html;charset=gb2312"%> <%@ page import="java.sql.*"%> <title>登录</title> <% String user=request.getParameter("user"); String pwd=request.getParameter("pwd"); if(user!=null) { String strurl="jdbc:odbc:driver={Microsoft ess Driver (*.mdb)};DBQ=data/data.mdb"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:driver={Microsoft ess Driver (*.mdb)};DBQ=D:/myweb/data/data.mdb"); Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); String sql="select * from users where user='"+user+"' and pwd='"+pwd+"'"; if(stmt.executeQuery(sql)) response.sendRedirect("index.jsp"); rs.close(); con.close(); } %> <table width=100% height=100% border=0> <tr> <td align=middle > <table border=1 style="border-color:black"><tr><td align=middle> <div style="width:400;height:200;background:skyblue;"> <div style=":50px"> <form method="post" action=""> <b>用户名</b>:<input type="text" name="user" id="user" size=19 value=""> <b>密??码</b>:<input type="password" name="pwd" id="pwd" size=20 value=""> <input type=submit value="提交" style="width:50px"> <input type=reset value="重设" style="width:50px"> </form> </div> </div> </td></tr></table> </td> </tr> </table>

香港九龙湾(27元) 2核2G 20元 香港沙田

弘速云是创建于2021年的品牌,运营该品牌的公司HOSU LIMITED(中文名称弘速科技有限公司)公司成立于2021年国内公司注册于2019年。HOSU LIMITED主要从事出售香港VPS、美国VPS、香港独立服务器、香港站群服务器等,目前在售VPS线路有CN2+BGP、CN2 GIA,该公司旗下产品均采用KVM虚拟化架构。可联系商家代安装iso系统。国庆活动 优惠码:hosu10-1产品介绍...

ReliableSite怎么样,月付$95美国洛杉矶独立服务器

ReliableSite怎么样?ReliableSite好不好。ReliableSite是一家成立于2006年的老牌美国商家,主要经营美国独立服务器租赁,数据中心位于:洛杉矶、迈阿密、纽约,带宽1Gbps起步,花19美元/月即可升级到10Gbps带宽,月流量150T足够各种业务场景使用,且免费提供20Gbps DDoS防护。当前商家有几款大硬盘美国独服,地点位于美国洛杉矶或纽约机房,机器配置很具有...

CheapWindowsVPS$4.5/月,美国VPS/免费Windows系统/1Gbps不限流量/,可选美洲、欧洲、亚洲等8大机房

国外商家提供Windows系统的并不常见,CheapWindowsVPS 此次提供的 2 款 VPS 促销套餐,提供 5 折永久优惠码,优惠后月付 4.5 美元起,价格还是挺诱人的,VPS 不限流量,接入 1Gbps 带宽,8 个机房皆可选,其中洛杉矶机房还提供亚洲优化网络供选择,操作系统有 Windows 10 专业版、2012 R2、2016、Linux等。Cheap Windows VPS是...

jsp网站源码为你推荐
电脑手机网页浏览器手机模拟电脑浏览器a8处理器什么是A8处理器?活跃网络十大网络家族排行榜详情硬盘分区格式化硬盘分区、格式化的主要步骤sd卡座SD卡座 FPC座子请问这些产品哪家厂家的货比较好啊?官方网店淘宝网的官方网店是什么趋势防毒趋势杀毒软件如何?安全网络攻防大赛CTF是什么意思上网能干什么手机上网能干什么有意思的事给我介绍一下硬盘文件不显示移动硬盘文件夹显示不出来
香港ufo 韩国空间 42u标准机柜尺寸 美国php空间 地址大全 免费ddos防火墙 租空间 双线主机 169邮箱 adroit 阿里校园 爱奇艺vip免费试用7天 vip购优惠 爱奇艺vip免费领取 日本代理ip ledlamp umax restart ubuntu安装教程 达拉斯 更多