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

📄 main.jsp

📁 一般网页里面实现图片切换的这个电子相册的代码
💻 JSP
字号:

<%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="UTF-8"%>
<%String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>梦境电子相册网站</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
	</head>

	<body style="BACKGROUND: #000000">
		<P>
			&nbsp;
			<BR>
		</P>
		<CENTER>
			&nbsp;<FONT color="#0000ff" size="5">欢迎光临我的电子相册网</FONT>
		</CENTER>
		<P></P>
		<P>
			<FONT color="#0000ff" size="6"></FONT>
		</P>
		<H3>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<BR>
			&nbsp;&nbsp;
			<BR>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A href="Login.jsp"><FONT color="#ff0080">登陆</FONT></A><FONT color="#ff0080"> &nbsp;&nbsp;</FONT><A href="UserRegister.jsp"><FONT color="#ff0080">注册</FONT></A><FONT color="#ff0080"> &nbsp;&nbsp;&nbsp;&nbsp;</FONT>
			<A href="Index.jsp"><FONT color="#ff0080">进入我的页面</FONT></A><FONT color="#ff0080"> &nbsp;&nbsp;&nbsp;&nbsp;</FONT>
		</H3>
		<P>
		</P>
		<P>
			<FONT color="#00ff00"> &nbsp;&nbsp;&nbsp;&nbsp; 最近新人</FONT>
		</P>
	
		<br>
		<%
			try {
				int total = 0;
				int i,j,k;
				Class.forName("com.mysql.jdbc.Driver");
				Connection c = DriverManager
						.getConnection("jdbc:mysql://localhost/myphone?user=root&password=123456"); // 连接mysql数据库
				Statement s = c.createStatement();

				String sql = "select distinct ID,time from userinfo order by time desc";
				System.out.println(sql);
				ResultSet r = s.executeQuery(sql);
				while (r.next() && total < 8) {
						total++;
						%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<FONT color="#ff0080"><%=r.getString(1) %> 
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						 注册时间:<%=r.getString(2) %>
						<%
							Statement t=c.createStatement();
							String ms="select * from picture where ID='" + r.getString(1)+"' and dirname='"+r.getString(1)+"' order by time";
							ResultSet ss=t.executeQuery(ms);
							int cnt = 0;
							while(ss.next() && cnt < 4)
							{
							%>
							<FONT color="#ff0080"><IMG name="myPicture" src='C:\test\<%=r.getString(1) %>\<%=r.getString(1) %>\<%=ss.getString(2) %>' width="40px" height="30px"></FONT>
							<%
								cnt++;
							} 
						%>
						 <br>
						 <br>
						 </font>
						<%
				}
				s.close();
				} catch (Exception e) {
					e.printStackTrace();
				}

		%>

	</body>
</html>

⌨️ 快捷键说明

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