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

📄 index.jsp

📁 网上书店jsp开发 购物车 收藏 使用servlet 是小型项目 仅供参考
💻 JSP
字号:
<%@page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=gb2312" %> 
<% request.setCharacterEncoding("GB2312"); %> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {
	font-family: "华文行楷", "隶书";
	font-size: 18mm;
	font-weight: bold;
	color: #00CCFF;
}
body,td,th {
	color: #00FFFF;
}
body {
	background-image: url(background/008.jpg);
}
.STYLE4 {
	font-size: 24pt;
	color: #00CCFF;
	font-family: "Arial Black", "Arial Narrow", Basemic, "Basemic Symbol", "Bookman Old Style", "Century Gothic", Tahoma;
	font-weight: bold;
}
.STYLE5 {
	color: #FF6600;
	font-weight: bold;
	font-size: 18px;
}
.STYLE7 {
	font-size: 24px;
	font-family: "宋体";
	color: #FF0000;
	font-weight: bold;
}
-->
</style>
</head>
<%!
	int count = 0;
	String filepath = "count.txt";
	BufferedReader in = null;
   //= new BufferedReader(new FileReader("foo.in"));
	PrintWriter pw = null;
	String temp = null;
	
	public void add(){
		File file = new File(filepath);
		if(!file.exists()){
			try{
				pw = new PrintWriter(new FileWriter(file));
				pw.println("0");
				pw.close();
			}catch(Exception e){
				e.printStackTrace();
			}
		}
		try{
			in = new BufferedReader(new FileReader("count.txt"));
			temp = in.readLine();
			int i = new Integer(temp);
			count = i + 1;
			in.close();
			
			pw = new PrintWriter(new FileWriter(file));
			pw.println(count);
			pw.close();
			
		}catch(Exception e){
				e.printStackTrace();
			}
	
	}
 %>
 
 <%
 	add();
  %>
<body>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="chooser.jsp">
  <p align="center" class="STYLE1">网 上 书 店</p>
  <p align="center" class="STYLE4">welcome</p>
  <p align="center" class="STYLE4">&nbsp;</p>
  <p align="center" class="STYLE5">
<input type="radio" name="radiobutton" value="user" /> 
普通用户
<input type="radio" name="radiobutton" value="administrators" />
管理员&nbsp;</p>
  <p>&nbsp;	</p>
  <p align="center">
    <input type="submit" name="Submit" value="确定" />
    &nbsp;&nbsp;
    <input type="reset" name="Submit2" value="重置" />
  </p>
  <p>&nbsp;</p>
</form>
	<p align="center" class="STYLE7">您是本站第 <span class="STYLE10"><%=count %></span> 位访问者!</p>
</body>
</html>

⌨️ 快捷键说明

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