歌单管理系统——小型javaweb项目

2023-10-10 06:50

本文主要是介绍歌单管理系统——小型javaweb项目,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、项目运行截图:







二、项目用到的相关知识:

jsp动态页面,css样式,struts2,hibernate,sql server


三、项目运行步骤:

1.在myelipse里发布项目,并启动tomcat。



2.打开chrome,在地址栏输入http://localhost:8080/项目名/


3.输入数据库内预存的用户名密码,以及当前生成的验证码即可登录。


四、项目构建步骤:

1.新建项目




2.构建struts2环境。将struts2所需的jar包拷入WebRoot->WEB-INF->lib中


在src目录下创建struts.xml


内容如下:

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN""http://struts.apache.org/dtds/struts-2.5.dtd"><struts><package name="default" extends="struts-default"></package><constant name="struts.i18n.encoding" value="UTF-8"></constant>
</struts>

将WebRoot->WEB-INF->web.xml内容修改如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"><display-name>aa</display-name><!-- Filters --><!-- START SNIPPET: filter --><filter><filter-name>action</filter-name><filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><!-- END SNIPPET: filter --><filter-mapping><filter-name>action</filter-name><url-pattern>/*</url-pattern></filter-mapping><welcome-file-list><welcome-file>login.jsp</welcome-file></welcome-file-list>
</web-app>

3.将sql server驱动拷入WebRoot->WEB-INF->lib中。(sqljdbc42.jar)


4.建立数据库

右键数据库->新建数据库


打开数据库AA,点击新建查询。

输入如下sql语句。

create table userTable
(  
id int identity(1,1) primary key not null, 
username varchar(20) not null, 
password varchar(50) not null, 
email varchar(20) not null,
birthday date  not null,
idnumber varchar(20) not null,
sex varchar(10) not null,
qualify varchar(50) not null
) 
create table musicTable
(  
id int identity(1,1) primary key not null, 
uploader varchar(20) not null,
songtitle varchar(30) not null, 
singer varchar(30) not null,
songimg varchar(20)  not null,
audiolength varchar(20) not null,
songarea varchar(20) not null) insert into userTable values('root','root0000','root@163.com','1995-01-06','140211199701253265','男','大学本科')
insert into userTable values('root1','root10000','root1@163.com','1995-02-06','140211199801253265','女','大学本科')
insert into userTable values('root2','root20000','root2@163.com','1995-03-06','140211199901253265','男','专科')
insert into userTable values('root3','root30000','root3@163.com','1995-04-06','140211199001253265','女','大学本科')
insert into userTable values('root4','root40000','root4@163.com','1995-05-06','140211199701253265','男','大学本科')insert into musicTable values('root','圣诞又至','鹿晗','1.jpg','04:40','内地')
insert into musicTable values('root1','狐狸','薛之谦','2.jpg','03:40','内地')
insert into musicTable values('root2','绒花','韩红','3.jpg','04:40','内地')
insert into musicTable values('root3','感觉自己是巨星','毛不易','4.jpg','04:30','内地')
insert into musicTable values('root4','易燃易爆炸','陈粒','5.jpg','04:40','内地')
insert into musicTable values('root','我在未来等你','齐秦','6.jpg','03:40','港台')
insert into musicTable values('root1','灰色 ','徐佳莹','7.jpg','04:40','港台')
insert into musicTable values('root2','叙述','毛不易','8.jpg','04:30','港台')
insert into musicTable values('root3','他不知道','陈志朋','9.jpg','03:40','港台')
insert into musicTable values('root4','凤凰于飞','林俊杰','10.jpg','04:43','港台')
insert into musicTable values('root','We Are The Brave','Lenka','11.jpg','04:40','欧美')
insert into musicTable values('root1','Thuunder','Dragons','12.jpg','03:40','欧美')
insert into musicTable values('root2','Perfect Duct','Beyonce','13.jpg','04:43','欧美')
insert into musicTable values('root3','Again Noah','Cyrus ','14.jpg','04:40','欧美')
insert into musicTable values('root4','Stir Fry','Migos','15.jpg','03:40','欧美')
insert into musicTable values('root','道','宇多田','16.jpg','04:30','日本')
insert into musicTable values('root1','Welcome To Tokyo','三代目','17.jpg','04:40','日本')
insert into musicTable values('root2','恋','星野源','18.jpg','04:40','日本')
insert into musicTable values('root3','极乐净土','GarniDelia','19.jpg','04:40','日本')
insert into musicTable values('root4','GoodBye Happiness','宇多田','20.jpg','04:40','日本')
insert into musicTable values('root','苦恼','Gary','21.jpg','04:40','韩国')
insert into musicTable values('root1','Birthday Remix','朴宰范','22.jpg','04:40','韩国')
insert into musicTable values('root2','Do My Thing','Beon','23.jpg','04:40','韩国')
insert into musicTable values('root3','Hello','SecenTeen','24.jpg','04:40','韩国')
insert into musicTable values('root4','I Just Red ','Velvet','25.jpg','04:40','韩国')

单击执行


右键登录名->新建登录名



单击确定

连接对象资源管理器


5.myeclipse连接数据库


右键->new


在src目录下建立四个包:action、bean、config、method


6.配置hibernate环境



7.hibernate自动关联数据库






结束之后,目录是这样。


8.在WebRoot目录下建立jsp页面:

add.jsp,del.jsp,error.jsp,hongkong.jsp,japan.jsp,korea,jsp,local.jsp,login.jsp,main.jsp,prelogout.jsp,register.jsp,registersucc.jsp,result.jsp,update.jsp,usa.jsp等页面。

各页面内容如下:

add.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>主页</title><link rel="stylesheet" type="text/css" href="css/style1.css"></head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60" src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>添加歌曲</h2></div><div class="center-up"><div class="song-box"><s:form id="formf" method="post" theme="simple" action="upload"enctype="multipart/form-data"><table><tr><td>歌曲名称:<s:textfield id="inp" label="歌曲名称" name="music.songtitle"></s:textfield></td></tr><tr><td>歌手名字:<s:textfield id="inp" label="歌手名字" name="music.singer"></s:textfield></td></tr><tr><td>歌曲封面:<s:file id="inp" label="歌曲封面" name="upload" /></td></tr><tr><td>歌曲地区:<s:select id="inp" list="#{'内地':'内地','港台':'港台','欧美':'欧美','日本':'日本','韩国':'韩国'}"  headerValue="请选择歌曲地区" name="music.songarea"></s:select></td></tr><tr><td>歌曲时长:<s:textfield id="inp" label="歌曲时长" name="music.audiolength"></s:textfield></td></tr><tr><td>上传用户:<s:textfield id="inp" label="上传用户" name="music.uploader"></s:textfield></td></tr><tr><td><s:submit id="submit" value="添加" /></td></tr></table></s:form></div></div><div class="center-down"></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

del.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>主页</title><link rel="stylesheet" type="text/css" href="css/style1.css"></head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" href="#"><img width="97" height="60" src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>是否确定删除歌曲?</h2></div><div class="center-up"><div class="song-box"><s:form id="formf" method="post" action="del"><table><tr><td><s:textfield id="inp" label="歌曲所在页码" name="pageNum"></s:textfield></td></tr><tr><td><s:textfield id="inp" label="歌曲id" name="music.id"></s:textfield></td></tr><tr><td><s:submit id="submit" value="确定删除" /></td></tr></table></s:form></div></div><div class="center-down"></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

error.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
<title>error</title>
</head>
<body>error!</body>
</html>

hongkong.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>hongkong</title><link rel="stylesheet" type="text/css" href="css/style.css"></head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60" src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>摇滚     共有<s:property value="Amount2" />首歌曲</h2></div><div class="center-up"><div class="song-box"><s:iterator value="list" var="music"><div class="song"><div class="one"><img alt="图片"src="${pageContext.servletContext.contextPath}/img/${songimg}" /></div><div class="two"><div class="two-1"><h4><s:property value="#music.songtitle" /></h4></div><div class="two-2"><h4><s:property value="#music.singer" /></h4></div><div class="two-3"><h4><s:property value="#music.uploader" />   <s:property value="#music.audiolength" /></h4></div></div><div class="three"><div class="three-1"><div class="update"><s:a href="preupdate?music.id=%{#music.id}&pageNum=%{pageNum}">修改</s:a></div></div><div class="three-2"><div class="delete"> <s:a href="predel?music.id=%{#music.id}&pageNum=%{pageNum}">删除</s:a></div></div></div></div></s:iterator></div></div><div class="center-down"><ul><li><a>第<s:property value="pageNum2" />页|共<s:propertyvalue="totalpage2" />页</a></li><li><s:url var="firstpage" action="hongkong"><s:param name="pageNum2">1</s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url> <s:a href="%{firstpage}">首页</s:a></li><li><s:if test="pageNum2!=1"><s:url var="prePage2" action="hongkong"><s:param name="pageNum2"><s:property value="pageNum2-1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url><s:a href="%{prePage}">上一页</s:a></s:if></li><li><s:if test="pageNum2!=totalpage2"><s:url var="nextPage" action="hongkong"><s:param name="pageNum2"><s:property value="pageNum2+1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url><s:a href="%{nextPage}">下一页</s:a></s:if></li><li><s:url var="lastPage2" action="hongkong"><s:param name="pageNum2"><s:property value="totalpage2" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url> <s:a href="%{lastPage}">末页</s:a></li></ul></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

japan.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE html>
<html><head><meta charset="utf-8"><title>japan</title><link rel="stylesheet" type="text/css" href="css/style.css"></head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60" src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>轻音乐     共有<s:property value="Amount3" />首歌曲</h2></div><div class="center-up"><div class="song-box"><s:iterator value="list" var="music"><div class="song"><div class="one"><img  alt="图片"src="${pageContext.servletContext.contextPath}/img/${songimg}" /></div><div class="two"><div class="two-1"><h4><s:property value="#music.songtitle" /></h4></div><div class="two-2"><h4><s:property value="#music.singer" /></h4></div><div class="two-3"><h4><s:property value="#music.uploader" />   <s:property value="#music.audiolength" /></h4></div></div><div class="three"><div class="three-1"><div class="update"><s:a href="preupdate?music.id=%{#music.id}&pageNum=%{pageNum}">修改</s:a></div></div><div class="three-2"><div class="delete"> <s:a href="predel?music.id=%{#music.id}&pageNum=%{pageNum}">删除</s:a></div></div></div></div></s:iterator></div></div><div class="center-down"><ul><li><a>第<s:property value="pageNum4" />页|共<s:propertyvalue="totalpage4" />页</a></li><li><a>共<s:propertyvalue="totalpage" />页</a></li><li><s:url var="firstpage" action="japan"><s:param name="pageNum4">1</s:param></s:url> <s:a href="%{firstpage}">首页</s:a></li><li><s:if test="pageNum4!=1"><s:url var="prePage" action="japan"><s:param name="pageNum4"><s:property value="pageNum4-1" /></s:param></s:url><s:a href="%{prePage}">上一页</s:a></s:if></li><s:if test="pageNum4!=totalpage4"><s:url var="nextPage" action="japan"><s:param name="pageNum4"><s:property value="pageNum4+1" /></s:param></s:url><s:a href="%{nextPage}">下一页</s:a></s:if></li><li><s:url var="lastPage" action="japan"><s:param name="pageNum4"><s:property value="totalpage4" /></s:param></s:url> <s:a href="%{lastPage}">末页</s:a></li></ul></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

korea,jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE html>
<html><head><meta charset="utf-8"><title>korea</title><link rel="stylesheet" type="text/css" href="css/style.css"></head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60" src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>蓝调     共有<s:property value="Amount4" />首歌曲</h2></div><div class="center-up"><div class="song-box"><s:iterator value="list" var="music"><div class="song"><div class="one"><img  alt="图片"src="${pageContext.servletContext.contextPath}/img/${songimg}" /></div><div class="two"><div class="two-1"><h4><s:property value="#music.songtitle" /></h4></div><div class="two-2"><h4><s:property value="#music.singer" /></h4></div><div class="two-3"><h4><s:property value="#music.uploader" />   <s:property value="#music.audiolength" /></h4></div></div><div class="three"><div class="three-1"><div class="update"><s:a href="preupdate?music.id=%{#music.id}&pageNum=%{pageNum}">修改</s:a></div></div><div class="three-2"><div class="delete"> <s:a href="predel?music.id=%{#music.id}&pageNum=%{pageNum}">删除</s:a></div></div></div></div></s:iterator></div></div><div class="center-down"><ul><li><a>第<s:property value="pageNum5" />页|共<s:propertyvalue="totalpage5" />页</a></li><li><s:url var="firstpage" action="korea"><s:param name="pageNum5">1</s:param></s:url> <s:a href="%{firstpage}">首页</s:a></li><li><s:if test="pageNum5!=1"><s:url var="prePage" action="korea"><s:param name="pageNum5"><s:property value="pageNum5-1" /></s:param></s:url><s:a href="%{prePage}">上一页</s:a></s:if></li><li><s:if test="pageNum5!=totalpage5"><s:url var="nextPage" action="korea"><s:param name="pageNum5"><s:property value="pageNum5+1" /></s:param></s:url><s:a href="%{nextPage}">下一页</s:a></s:if></li><li><s:url var="lastPage" action="korea"><s:param name="pageNum5"><s:property value="totalpage5" /></s:param></s:url> <s:a href="%{lastPage}">末页</s:a></li></ul></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

local.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<title>local</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60"src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>流行     共有<s:property value="Amount1" />首歌曲</h2></div><div class="center-up"><div class="song-box"><s:iterator value="list" var="music"><div class="song"><div class="one"><img alt="图片"src="${pageContext.servletContext.contextPath}/img/${songimg}" /></div><div class="two"><div class="two-1"><h4><s:property value="#music.songtitle" /></h4></div><div class="two-2"><h4><s:property value="#music.singer" /></h4></div><div class="two-3"><h4><s:property value="#music.uploader" /><s:property value="#music.audiolength" /></h4></div></div><div class="three"><div class="three-1"><div class="update"><s:a href="preupdate?music.id=%{#music.id}&pageNum=%{pageNum}">修改</s:a></div></div><div class="three-2"><div class="delete"><s:a href="predel?music.id=%{#music.id}&pageNum=%{pageNum}">删除</s:a></div></div></div></div></s:iterator></div></div><div class="center-down"><ul><li><a>第<s:property value="pageNum1" />页|共<s:propertyvalue="totalpage1" />页</a></li><li><s:url var="firstpage" action="local"><s:param name="pageNum1">1</s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url> <s:a href="%{firstpage}">首页</s:a></li><li><s:if test="pageNum1!=1"><s:url var="prePage" action="local"><s:param name="pageNum1"><s:property value="pageNum1-1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url><s:a href="%{prePage}">上一页</s:a></s:if></li><li><s:if test="pageNum1!=totalpage1"><s:url var="nextPage" action="local"><s:param name="pageNum1"><s:property value="pageNum1+1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url><s:a href="%{nextPage}">下一页</s:a></s:if></li><li><s:url var="lastPage" action="local"><s:param name="pageNum1"><s:property value="totalpage1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url> <s:a href="%{lastPage}">末页</s:a></li></ul></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

login.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/style2.css">
<title>login</title>
<script type="text/javascript">function refresh() {//IE存在缓存,需要new Date()实现更换路径的作用    document.getElementById("image").src = "createImageAction.action?+ Math.random()" + new Date();}
</script>
</head><body><div class="head"><div class="head-center"><div class="logo-box"><a class="logo" href="#"><img width="97" height="60"src="img/logo.png"></a></div></div></div><div class="middle"><div class="middle-center"><div class="welcom"><s:form cssClass="form" action="login" method="post" theme="simple"><div class="one"><s:textfield cssClass="one-button" placeholder="用户名" name="user.username"></s:textfield></div><div class="one"><s:password cssClass="one-button" placeholder="密码" name="user.password"></s:password></div><div class="one"><div class="one-left"><s:textfield cssClass="one-left-button" placeholder="验证码" name="checkCode" maxlength="4" /></div><div class="one-right"><s:a cssClass="one-right-button" href="javascript:refresh()"><img id="image"  src="createImageAction.action" /></s:a></div></div><div class="one"><div class="one-left"><s:submit id="submit"  cssClass="one-left-button" value="登录" /></div><div class="one-rr"><s:a cssClass="one-right-button" href="register.jsp">注册</s:a></div></div></s:form></div></div></div><div class="footer"><div class="foot"><div class="foot-two"><div class="error-left"><s:fielderror class="error"/> </div><h4>王骏&copy;期末作品</h4></div></div></div></body></html>

main.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>主页</title><link rel="stylesheet" type="text/css" href="css/style.css"></head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60" src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>主页     共有<s:property value="Amount" />首歌曲</h2></div><div class="center-up"><div class="song-box"><s:iterator value="list" var="music"><div class="song"><div class="one"><img width="66px" height="66px" alt="图片"src="${pageContext.servletContext.contextPath}/img/${songimg}" /></div><div class="two"><div class="two-1"><h4><s:property value="#music.songtitle" /></h4></div><div class="two-2"><h4><s:property value="#music.singer" /></h4></div><div class="two-3"><h4><s:property value="#music.uploader" />   <s:property value="#music.audiolength" /></h4></div></div><div class="three"><div class="three-1"><div class="update"><s:a href="preupdate?music.id=%{#music.id}&pageNum=%{pageNum}">修改</s:a></div></div><div class="three-2"><div class="delete"> <s:a href="predel?music.id=%{#music.id}&pageNum=%{pageNum}">删除</s:a></div></div></div></div></s:iterator></div></div><div class="center-down"><ul><li><a>第<s:property value="pageNum" />页</a></li><li><a>共<s:propertyvalue="totalpage" />页</a></li><li><s:url var="firstpage" action="find"><s:param name="pageNum">1</s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url> <s:a href="%{firstpage}">首页</s:a></li><li><s:if test="pageNum!=1"><s:url var="prePage" action="find"><s:param name="pageNum"><s:property value="pageNum-1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url><s:a href="%{prePage}">上一页</s:a></s:if></li><li><s:if test="pageNum!=totalpage"><s:url var="nextPage" action="find"><s:param name="pageNum"><s:property value="pageNum+1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url><s:a href="%{nextPage}">下一页</s:a></s:if></li><li><s:url var="lastPage" action="find"><s:param name="pageNum"><s:property value="totalpage" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url> <s:a href="%{lastPage}">末页</s:a></li></ul></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

prelogout.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/style4.css">
<meta http-equiv="refresh" content="3; url='login.jsp'">
<title>register</title>
</head>
<body><div class="head"><div class="head-center"><div class="logo-box"><a class="logo" href="#"><img width="97" height="60"src="img/logo.png"></a></div></div></div><div class="middle"><div class="middle-center"><div class="welcom"><h3>3秒后,跳转到登录页面。</h3></div></div></div><div class="footer"><div class="foot"><div class="foot-two"><div class="error-left"><s:fielderror class="error" /></div><h4>王骏&copy;期末作品</h4></div></div></div>
</body>
</html>

register.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/style4.css">
<title>register</title>
</head>
<body><div class="head"><div class="head-center"><div class="logo-box"><a class="logo" href="#"><img width="97" height="60"src="img/logo.png"></a></div></div></div><div class="middle"><div class="middle-center"><div class="welcom"><s:form cssClass="form" action="register" method="post"theme="simple"><div class="one"><s:textfield cssClass="one-button" placeholder="用户名" label="用户名"name="user.username"></s:textfield></div><div class="one"><s:password cssClass="one-button" placeholder="密码" label="密码"name="user.password"></s:password></div><div class="one"><div class="one-left"><s:select cssClass="one-left-button" placeholder="性别"list="#{'男':'男','女':'女'}" label="性別" headerValue="请选择性別"name="user.sex"></s:select></div><div class="one-left"><s:select cssClass="one-right-button" placeholder="学历"list="#{'大学本科':'大学本科','专科':'专科','硕士研究生':'硕士研究生','博士研究生':'博士研究生'}"label="学历" headerValue="请选择歌曲地区" name="user.qualify"></s:select></div></div><div class="one"><s:textfield cssClass="one-button" placeholder="邮箱地址"name="user.email"></s:textfield></div><div class="one"><s:textfield cssClass="one-button" placeholder="出生日期"name="user.birthday"></s:textfield></div><div class="one"><s:textfield cssClass="one-button" placeholder="身份证号"name="user.idnumber"></s:textfield></div><div class="one"><div class="one-left"><s:submit id="submit" cssClass="one-left-button" value="注册" /></div></div></s:form></div></div></div><div class="footer"><div class="foot"><div class="foot-two"><div class="error-left"><s:fielderror class="error" /></div><h4>王骏&copy;期末作品</h4></div></div></div>
</body>
</html>

registersucc.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="3; url='login.jsp'">
<title>跳转</title>
</head>
<body><a>注册成功!3秒后跳转到登录页面。</a></body>
</html>

result.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>主页</title><link rel="stylesheet" type="text/css" href="css/style.css"></head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60" src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>搜索结果     找到<s:property value="Amount6" />首歌曲</h2></div><div class="center-up"><div class="song-box"><s:iterator value="list" var="music"><div class="song"><div class="one"><img  alt="图片"src="${pageContext.servletContext.contextPath}/img/${songimg}" /></div><div class="two"><div class="two-1"><h4><s:property value="#music.songtitle" /></h4></div><div class="two-2"><h4><s:property value="#music.singer" /></h4></div><div class="two-3"><h4><s:property value="#music.uploader" />   <s:property value="#music.audiolength" /></h4></div></div><div class="three"><div class="three-1"><div class="update"><s:a href="preupdate?music.id=%{#music.id}&pageNum=%{pageNum}">修改</s:a></div></div><div class="three-2"><div class="delete"> <s:a href="predel?music.id=%{#music.id}&pageNum=%{pageNum}">删除</s:a></div></div></div></div></s:iterator></div></div><div class="center-down"></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

update.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html><head><meta charset="utf-8"><title>主页</title><link rel="stylesheet" type="text/css" href="css/style1.css"></head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60" src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>修改歌曲</h2></div><div class="center-up"><div class="song-box"><s:form id="formf" action="update"><table><tr><td><s:hidden id="inp" label="歌曲ID" name="music.id"></s:hidden></td></tr><tr><td><s:hidden id="inp" label="歌曲所在页码" name="pageNum"></s:hidden></td></tr><tr><td><s:textfield id="inp" label="歌曲名称" name="music.songtitle"></s:textfield></td></tr><tr><td><s:textfield id="inp" label="歌手名字" name="music.singer"></s:textfield></td></tr><tr><td><s:select id="inp" label="歌曲风格" list="#{'流行':'流行','摇滚':'摇滚','民族':'民族','轻音乐':'轻音乐','蓝调':'蓝调'}"  headerValue="请选择歌曲风格" name="music.songarea"></s:select></td></td></tr><tr><td><s:submit id="submit" value="修改" /></td></tr></table></s:form></div></div><div class="center-down"></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

usa.jsp

<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE htm
l>
<html><head>
<meta charset="utf-8">
<title>usa</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head><body><div class="head"><div class="headcenter"><div class="logo-box"><a class="logo" ref="#"><img width="97" height="60"src="img/logo.png"></a></div><div class="search-box"><div class="search bar7"><s:form action="search"><input type="text" placeholder="请输入歌曲名称..." name="keyString"><button type="submit"></button></s:form></div></div><div class="center-box"></div><div class="reset"><ul><li><a href="prelogout.jsp">注销</a></li></ul></div></div></div><div class="banner"><div class="banner-center"><div class="banner-li-box"><ul><li><s:a href="find">首页</s:a></li><li><s:a href="local">流行</s:a></li><li><s:a href="hongkong">摇滚</s:a></li><li><s:a href="usa">民族</s:a></li><li><s:a href="japan">轻音乐</s:a></li><li><s:a href="korea">蓝调</s:a></li></ul></div></div><div class="banner-li-box-center"></div><div class="downandadd"><ul><li><a href="createMusicList">下载</a></li><li><a href="add.jsp">添加</a></li></ul></div></div><div class="main"><div class="main-center"><div class="center-up-up"><h2>民族     共有<s:property value="Amount2" />首歌曲</h2></div><div class="center-up"><div class="song-box"><s:iterator value="list" var="music"><div class="song"><div class="one"><img alt="图片"src="${pageContext.servletContext.contextPath}/img/${songimg}" /></div><div class="two"><div class="two-1"><h4><s:property value="#music.songtitle" /></h4></div><div class="two-2"><h4><s:property value="#music.singer" /></h4></div><div class="two-3"><h4><s:property value="#music.uploader" /><s:property value="#music.audiolength" /></h4></div></div><div class="three"><div class="three-1"><div class="update"><s:a href="preupdate?music.id=%{#music.id}&pageNum=%{pageNum}">修改</s:a></div></div><div class="three-2"><div class="delete"><s:a href="predel?music.id=%{#music.id}&pageNum=%{pageNum}">删除</s:a></div></div></div></div></s:iterator></div></div><div class="center-down"><ul><li><a>第<s:property value="pageNum3" />页|共<s:propertyvalue="totalpage3" />页</a></li><li><s:url var="firstpage" action="usa"><s:param name="pageNum3">1</s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url> <s:a href="%{firstpage}">首页</s:a></li><li><s:if test="pageNum3!=1"><s:url var="prePage" action="usa"><s:param name="pageNum3"><s:property value="pageNum3-1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url><s:a href="%{prePage}">上一页</s:a></s:if></li><li><s:if test="pageNum!=totalpage"><s:url var="nextPage" action="usa"><s:param name="pageNum3"><s:property value="pageNum3+1" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url><s:a href="%{nextPage}">下一页</s:a></s:if></li><li><s:url var="lastPage" action="usa"><s:param name="pageNum3"><s:property value="totalpage3" /></s:param><s:param name="username"><s:property value="user.username" /></s:param></s:url> <s:a href="%{lastPage}">末页</s:a></li></ul></div></div></div><div class="footer"><h4>王骏&copy;期末作品</h4></div></body></html>

在WebRoot目录建立css文件夹,新建css文件,style.css,style1.css,style2.css,style3.css。

style.css

[genuitec-file-id="wc1-1"],[genuitec-lp-path="/ss/WebRoot/css/style.css"],[genuitec-lp-enabled=false]{/* for codelive */
}body {background: rgb(250,250,250);margin: 0px;padding: 0px;font-size: 15px;font-family: 'Microsoft Yahei', Tahoma, Helvetica, Arial, sans-serif;
}.head {width: 100%;height: 60px;min-width: 1000px;background: #222;text-align: center;
}.headcenter {width: 1000px;margin: 0 auto;background: #222;
}.logo-box {margin: 0px;padding: 0px;width: 97px;height: 60px;float: left;
}.search-box {width: 360px;height: 60px;margin: 0px;padding: 0px;background: #222;float: left;
}.center-box {width: 483px;height: 60px;margin: 0px;padding: 0px;background: #222;float: left;
}
div.search {padding:10px 0;
}
form {position:relative;width:262px;margin:0 auto;
}
input,button {border:none;outline:none;}
input {width:100%;height:32px;color: rgb(252,250,232);}
button {height:0px;width:0px;color: rgb(252,250,232);cursor:pointer;position:absolute;
}
.bar7 form {height:20px;
}
.bar7 input {width:250px;border-radius:42px;border:1px solid rgb(102,204,0);background:#222;transition:.3s linear;float:right;
}
.bar7 input:focus {width:300px;
}
.bar7 button {background:none;right: 45px;top: 7px;}
.bar7 button:before {content:"Search";font-family:FontAwesome;color:rgb(252,250,232);
}
.reset {width: 60px;height: 60px;margin: 0px;padding: 0px;background: #222;float: left;
}.banner {width: 100%;height: 38px;min-width: 1000px;background: #222;text-align: center;
}.banner-center {width: 1000px;margin: 0 auto;background: #222;
}.banner-li-box {width: 480px;height: 38px;margin: 0px;padding: 0px;background: #222;float: left;
}.banner-li-box ul li a {display: block;padding: 9px 6px 11px 6px;margin: 0px;
}.banner-li-box a:link,
.banner-li-box a:visited {color: #fff;text-decoration: none;
}.banner-li-box a:hover {color: rgb(102,204,0);text-decoration: none;background: url(../img/hover.png) no-repeat;
}.banner-li-box-center {width: 360px;height: 38px;margin: 0px;padding: 0px;background: #222;float: left;
}.downandadd {width: 160px;height: 38px;margin: 0px;padding: 0px;background: #222;float: left;
}.downandadd ul {list-style-type: none;padding: 0px;margin: 0px;
}.downandadd ul li {float: left;text-align: center;width: 80px;
}.downandadd ul li a {display: block;padding: 9px 6px 11px 6px;margin: 0px;
}.downandadd a:link,
.downandadd a:visited {color: #fff;text-decoration: none;
}.downandadd a:hover {color: rgb(102,204,0);text-decoration: none;background: url(../img/hover.png) no-repeat;
}.reset ul {list-style-type: none;padding: 0px;margin: 0px;
}.reset ul li {float: left;text-align: center;width: 60px;
}.reset ul li a {display: block;padding: 20px 6px 11px 6px;margin: 0px;
}.reset a:link,
.reset a:visited {color: #fff;text-decoration: none;
}.reset a:hover {color: rgb(102,204,0);text-decoration: none;
}.banner-li-box ul {list-style-type: none;padding: 0px;margin: 0px;
}.banner-li-box ul li {float: left;text-align: center;width: 80px;
}.main {width: 100%;height: 580px;min-width: 1000px;background: rgba(250, 250, 250,0);text-align: center;
}.main-center {width: 1000px;margin: 0 auto;background: rgba(255, 255, 255,0);
}.center-up-up {width: 1000px;height: 50px;margin: 0px;padding: 0px;background: rgb(250, 250, 250);float: left;
}
.center-up-up h2{float: left;
}
.center-up {width: 1000px;height: 480px;margin: 0px;padding: 0px;background: url(../img/bac.png);border-radius: 5px 5px 5px 5px;float: left;
}.center-down {width: 1000px;height: 40px;margin: 0px;padding: 0px;background: #222;color: #fff;float: left;border-radius: 5px 5px 5px 5px;
}.center-down ul {list-style-type: none;padding: 0px;margin: 0px;
}.center-down ul li {float: left;text-align: center;width: 60px;
}
.center-down ul li a {display: block;padding: 9px 6px 11px 6px;margin: 0px;
}.center-down a:link,
.center-down a:visited {color: #fff;text-decoration: none;
}.center-down a:hover {color: rgb(102,204,0);text-decoration: none;background: url(../img/hoverdown.png) no-repeat;
}.footer {width: 100%;height: 60px;min-width: 1000px;background: #222;text-align: center;
}
.footer h4{color: #fff;
}.song-box {width: 990px;height: 470px;margin: 5px 5px;padding: 0px;background: rgba(255,255,255,0);float: left;
}.song {margin: 3.5px 2.5px 3px 3.5px;padding: 0px;width: 487px;height: 150px;border:0.1px solid #222;background: url(../img/songbac.png) no-repeat;float: left;border-radius: 5px;
}.one {width: 150px;height: 150px;margin: 0px;padding: 0px;background: rgba(255,255,255,0.7);float: left;border-radius: 5px 0px 0px 5px;
}.one img {width: 150px;height: 150px;border-radius: 5px 0px 0px 5px;
}.two {width: 187px;height: 150px;margin: 0px;padding: 0px;background: rgba(255,255,255,0.7);float: left;
}.three {width: 150px;height: 150px;margin: 0px;padding: 0px;background: rgba(255,255,255,0.7);float: left;border-radius: 0px 5px 5px 0px;
}.two-1 {width: 187px;height: 50px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;
}.two-2 {width: 187px;height: 50px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;
}.two-3 {width: 187px;height: 50px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;
}.three-1 {width: 150px;height: 75px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;border-radius: 0px 5px 0px 0px;
}.three-2 {width: 150px;height: 75px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;border-radius: 0px 0px 5px 0px;
}.update{margin: 20px 25px 20px 25px;padding: 0px;width: 100px;height: 35px;border:1px solid #222;background-color: rgba(255,255,255,0);line-height: 30px;text-align: center;border-radius: 5px 5px 5px 5px;
}
.delete{margin: 20px 25px 20px 25px;padding: 0px;width: 100px;height: 35px;border:1px solid #222;background-color: rgba(255,255,255,0);line-height: 30px;text-align: center;border-radius: 5px 5px 5px 5px;
}
.update  a {display: block;padding: 2.5px 2.5px 2.5px 2.5px;margin: 0px;border-radius: 3px 3px 3px 3px;}
.update a:link,
.update a:visited {color: #222;text-decoration: none;
}.update a:hover {color: rgb(255,255,255);text-decoration: none;background: #222;
}
.delete a {display: block;padding: 2.5px 2.5px 2.5px 2.5px;margin: 0px;border-radius: 3px 3px 3px 3px;}
.delete a:link,
.delete a:visited {color: #222;text-decoration: none;
}.delete a:hover {color: rgb(255,255,255);text-decoration: none;background: #222;
}

style1.css

[genuitec-file-id="wc1-2"],[genuitec-lp-path="/ss/WebRoot/css/style1.css"],[genuitec-lp-enabled=false]{/* for codelive */
}body {background: rgb(250,250,250);margin: 0px;padding: 0px;font-size: 15px;font-family: 'Microsoft Yahei', Tahoma, Helvetica, Arial, sans-serif;
}.head {width: 100%;height: 60px;min-width: 1000px;background: #222;text-align: center;
}.headcenter {width: 1000px;margin: 0 auto;background: #222;
}.logo-box {margin: 0px;padding: 0px;width: 97px;height: 60px;float: left;
}.search-box {width: 360px;height: 60px;margin: 0px;padding: 0px;background: #222;float: left;
}.center-box {width: 483px;height: 60px;margin: 0px;padding: 0px;background: #222;float: left;
}
div.search {padding:10px 0;
}
form {position:relative;width:262px;margin:0 auto;
}
input,button {border:none;outline:none;}
input {width:100%;height:32px;color: #222;}
button {height:0px;width:0px;color: rgb(252,250,232);cursor:pointer;position:absolute;
}
.bar7 form {height:20px;
}
.bar7 input {width:250px;border-radius:42px;border:1px solid rgb(102,204,0);background:#222;transition:.3s linear;float:right;
}
.bar7 input:focus {width:300px;
}
.bar7 button {background:none;right: 45px;top: 7px;}
.bar7 button:before {content:"Search";font-family:FontAwesome;color:rgb(252,250,232);
}
.reset {width: 60px;height: 60px;margin: 0px;padding: 0px;background: #222;float: left;
}.banner {width: 100%;height: 38px;min-width: 1000px;background: #222;text-align: center;
}.banner-center {width: 1000px;margin: 0 auto;background: #222;
}.banner-li-box {width: 480px;height: 38px;margin: 0px;padding: 0px;background: #222;float: left;
}.banner-li-box ul li a {display: block;padding: 9px 6px 11px 6px;margin: 0px;
}.banner-li-box a:link,
.banner-li-box a:visited {color: #fff;text-decoration: none;
}.banner-li-box a:hover {color: rgb(102,204,0);text-decoration: none;background: url(../img/hover.png) no-repeat;
}.banner-li-box-center {width: 360px;height: 38px;margin: 0px;padding: 0px;background: #222;float: left;
}.downandadd {width: 160px;height: 38px;margin: 0px;padding: 0px;background: #222;float: left;
}.downandadd ul {list-style-type: none;padding: 0px;margin: 0px;
}.downandadd ul li {float: left;text-align: center;width: 80px;
}.downandadd ul li a {display: block;padding: 9px 6px 11px 6px;margin: 0px;
}.downandadd a:link,
.downandadd a:visited {color: #fff;text-decoration: none;
}.downandadd a:hover {color: rgb(102,204,0);text-decoration: none;background: url(../img/hover.png) no-repeat;
}.reset ul {list-style-type: none;padding: 0px;margin: 0px;
}.reset ul li {float: left;text-align: center;width: 60px;
}.reset ul li a {display: block;padding: 20px 6px 11px 6px;margin: 0px;
}.reset a:link,
.reset a:visited {color: #fff;text-decoration: none;
}.reset a:hover {color: rgb(102,204,0);text-decoration: none;
}.banner-li-box ul {list-style-type: none;padding: 0px;margin: 0px;
}.banner-li-box ul li {float: left;text-align: center;width: 80px;
}.main {width: 100%;height: 580px;min-width: 1000px;background: rgba(250, 250, 250,0);text-align: center;
}.main-center {width: 1000px;margin: 0 auto;background: rgba(255, 255, 255,0);
}.center-up-up {width: 1000px;height: 50px;margin: 0px;padding: 0px;background: rgb(250, 250, 250);float: left;
}
.center-up-up h2{float: left;
}
.center-up {width: 1000px;height: 480px;margin: 0px;padding: 0px;background: url(../img/bac.png);border-radius: 5px 5px 5px 5px;float: left;
}.center-down {width: 1000px;height: 40px;margin: 0px;padding: 0px;background: #222;color: #fff;float: left;border-radius: 5px 5px 5px 5px;
}.center-down ul {list-style-type: none;padding: 0px;margin: 0px;
}.center-down ul li {float: left;text-align: center;width: 60px;
}
.center-down ul li a {display: block;padding: 9px 6px 11px 6px;margin: 0px;
}.center-down a:link,
.center-down a:visited {color: #fff;text-decoration: none;
}.center-down a:hover {color: rgb(102,204,0);text-decoration: none;background: url(../img/hoverdown.png) no-repeat;
}.footer {width: 100%;height: 60px;min-width: 1000px;background: #222;text-align: center;
}
.footer h4{color: #fff;
}.song-box {width: 990px;height: 470px;margin: 5px 5px;padding: 0px;background: rgba(255,255,255,0);float: left;
}.song {margin: 3.5px 2.5px 3px 3.5px;padding: 0px;width: 487px;height: 150px;border:0.1px solid #222;background: url(../img/songbac.png) no-repeat;float: left;border-radius: 5px;
}
#submit{margin:20px 0px 1px 0px;height:38px;display: block;border:1px solid #222;border-radius: 5px;}#submit:link,
#submit:visited {color: #222;text-decoration: none;
}#submit:hover {color: rgb(255,255,255);text-decoration: none;background: #222;
}
#inp{border:1px solid #222;border-radius: 5px;
width: 185px;height: 35px;}
#formf{margin:50px auto auto 350px;}.one {width: 150px;height: 150px;margin: 0px;padding: 0px;background: rgba(255,255,255,0.7);float: left;border-radius: 5px 0px 0px 5px;
}.one img {width: 150px;height: 150px;border-radius: 5px 0px 0px 5px;
}.two {width: 187px;height: 150px;margin: 0px;padding: 0px;background: rgba(255,255,255,0.7);float: left;
}.three {width: 150px;height: 150px;margin: 0px;padding: 0px;background: rgba(255,255,255,0.7);float: left;border-radius: 0px 5px 5px 0px;
}.two-1 {width: 187px;height: 50px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;
}.two-2 {width: 187px;height: 50px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;
}.two-3 {width: 187px;height: 50px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;
}.three-1 {width: 150px;height: 75px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;border-radius: 0px 5px 0px 0px;
}.three-2 {width: 150px;height: 75px;margin: 0px;padding: 0px;background: rgba(255,255,255,0);float: left;border-radius: 0px 0px 5px 0px;
}.update{margin: 20px 25px 20px 25px;padding: 0px;width: 100px;height: 35px;border:1px solid #222;background-color: rgba(255,255,255,0);line-height: 30px;text-align: center;border-radius: 5px 5px 5px 5px;
}
.delete{margin: 20px 25px 20px 25px;padding: 0px;width: 100px;height: 35px;border:1px solid #222;background-color: rgba(255,255,255,0);line-height: 30px;text-align: center;border-radius: 5px 5px 5px 5px;
}
.update  a {display: block;padding: 2.5px 2.5px 2.5px 2.5px;margin: 0px;border-radius: 3px 3px 3px 3px;}
.update a:link,
.update a:visited {color: #222;text-decoration: none;
}.update a:hover {color: rgb(255,255,255);text-decoration: none;background: #222;
}
.delete a {display: block;padding: 2.5px 2.5px 2.5px 2.5px;margin: 0px;border-radius: 3px 3px 3px 3px;}
.delete a:link,
.delete a:visited {color: #222;text-decoration: none;
}.delete a:hover {color: rgb(255,255,255);text-decoration: none;background: #222;
}
.areabutton{
margin: 0px 6px 0px -5px;width: 142px;height: 35px;border-radius: 3px 3px 3px 3px;border: 1px solid #222;background: rgba(2, 2, 2, 0);
}

style2.css

[genuitec-file-id="wc1-3"],[genuitec-lp-path="/ss/WebRoot/css/style2.css"],[genuitec-lp-enabled=false]{/* for codelive */
}.body {background: blue;margin: 0px;padding: 0px;font-size: 15px;font-family: 'Microsoft Yahei', Tahoma, Helvetica, Arial, sans-serif;
}.head {width: 100%;height: 100px;min-width: 1000px;background: #fff;text-align: center;
}.head-center {width: 1000px;margin: 0 auto;background: #fff;
}.logo-box {margin: 0px;padding: 0px;width: 97px;height: 60px;float: left;
}.middle {width: 100%;height: 330px;min-width: 1000px;background: #A6D4AF;text-align: center;
}.middle-center {width: 1000px;margin: 0 auto;background: url(../img/kk.png) no-repeat;
}.welcom {margin: 0px;padding: 0px;width: 1000px;height: 330px;background: url(../img/TIM截图20171226230438.png);
}.form {/* 	margin: 0px 0px 0px 0px; *//* padding: 0px; */width: 344px;height: 330px;/* float:float; border-radius: 3px 3px 3px 3px;border:1px solid #222; */background:rgba(250,250,250,0.4);
}.footer {width: 100%;height: 60px;min-width: 1000px;background: #fff;text-align: center;
}.foot {width: 1000px;margin: 0 auto;background: #fff;
}.foot-two {margin: 0px;padding: 0px;width: 1000px;height: 60px;background: #fff;
}
.error-left{width: 300px;height: 60px;float:left;}.one {margin: 5px 0px 5px 20px;padding: 25px 0px 0px 0px;width: 304px;height: 38px;background: rgba(2, 2, 2, 0);/* 	border-radius: 3px 3px 3px 3px;border:1px solid #222; */
}.one-left {margin: 5px 5px 5px 5px;width: 142px;height: 38px;background: rgba(2, 2, 2, 0);/* 	border-radius: 3px 3px 3px 3px;border:1px solid #222; */float: left;
}
#submit{width: 145px;height: 40px;display: block;border:1px solid #222;border-radius: 3px 3px 3px 3px;font-size: 18px;font-family: 'Microsoft Yahei';}#submit:link,
#submit:visited {color: #222;text-decoration: none;
}#submit:hover {color: rgb(255,255,255);text-decoration: none;background: #222;
}
.one-right {margin: 5px 5px 5px 5px;width: 142px;height: 38px;background: rgba(2, 2, 2, 0);/* 	border-radius: 3px 3px 3px 3px;border:1px solid #222; */float: left;
}.one-button {width: 304px;height: 38px;border-radius: 3px 3px 3px 3px;border: 1px solid #222;background: rgba(2, 2, 2, 0);
}.one-left-button {margin: 0px 6px 0px -5px;width: 142px;height: 38px;border-radius: 3px 3px 3px 3px;border: 1px solid #222;background: rgba(2, 2, 2, 0);
}.one-right-button {margin: 0px 0px 0px 6px;width: 142px;height: 38px;border-radius: 3px 3px 3px 3px;border: 1px solid #222;background: rgba(2, 2, 2, 0);float: left;
}
.one-rr{margin: 5px 5px 5px 5px;width: 142px;height: 30px;background: rgba(2, 2, 2, 0);/* 	border-radius: 3px 3px 3px 3px;border:1px solid #222; */float: left;font-size: 18px;font-family: 'Microsoft Yahei';}.one-rr a:link,
.one-rr a:visited {color: #222;background:url(../img/registerb.png) np-repeat;text-decoration: none;
}.one-rr a:hover {color: #222;text-decoration: none;background: url(../img/register.png) no-repeat;
}
.error{list-style-type: none;color:red;
}

style3.css

[genuitec-file-id="wc1-4"],[genuitec-lp-path="/ss/WebRoot/css/style4.css"],[genuitec-lp-enabled=false]{/* for codelive */
}.body {background: blue;margin: 0px;padding: 0px;font-size: 15px;font-family: 'Microsoft Yahei', Tahoma, Helvetica, Arial, sans-serif;
}.head {width: 100%;height: 100px;min-width: 1000px;background: #fff;text-align: center;
}.head-center {width: 1000px;margin: 0 auto;background: #fff;
}.logo-box {margin: 0px;padding: 0px;width: 97px;height: 60px;float: left;
}.middle {width: 100%;height: 330px;min-width: 1000px;background: #A6D4AF;text-align: center;
}.middle-center {width: 1000px;margin: 0 auto;background: url(../img/kk.png) no-repeat;
}.welcom {margin: 0px;padding: 0px;width: 1000px;height: 330px;background: url(../img/TIM截图20171226230438.png);
}.form {/* 	margin: 0px 0px 0px 0px; *//* padding: 0px; */width: 344px;height: 330px;/* float:float; border-radius: 3px 3px 3px 3px;border:1px solid #222; */background:rgba(250,250,250,0.4);
}.footer {width: 100%;height: 60px;min-width: 1000px;background: #fff;text-align: center;
}.foot {width: 1000px;margin: 0 auto;background: #fff;
}.foot-two {margin: 0px;padding: 0px;width: 1000px;height: 60px;background: #fff;
}
.error-left{width: 300px;height: 60px;float:left;}.one {margin: 3px 0px 3px 20px;padding: 8px 0px 0px 0px;width: 304px;height: 35px;background: rgba(2, 2, 2, 0);/* 	border-radius: 3px 3px 3px 3px;border:1px solid #222; */
}.one-left {margin: 5px 5px 5px 5px;width: 142px;height: 35px;background: rgba(2, 2, 2, 0);/* 	border-radius: 3px 3px 3px 3px;border:1px solid #222; */float: left;
}
#submit{width: 145px;height: 40px;display: block;border:1px solid #222;border-radius: 3px 3px 3px 3px;font-size: 18px;font-family: 'Microsoft Yahei';}#submit:link,
#submit:visited {color: #222;text-decoration: none;
}#submit:hover {color: rgb(255,255,255);text-decoration: none;background: #222;
}
.one-right {margin: 5px 5px 5px 5px;width: 142px;height: 35px;background: rgba(2, 2, 2, 0);/* 	border-radius: 3px 3px 3px 3px;border:1px solid #222; */float: left;
}.one-button {width: 304px;height: 35px;border-radius: 3px 3px 3px 3px;border: 1px solid #222;background: rgba(2, 2, 2, 0);
}.one-left-button {margin: 0px 6px 0px -5px;width: 142px;height: 35px;border-radius: 3px 3px 3px 3px;border: 1px solid #222;background: rgba(2, 2, 2, 0);
}.one-right-button {margin: 0px 0px 0px 6px;width: 142px;height: 35px;border-radius: 3px 3px 3px 3px;border: 1px solid #222;background: rgba(2, 2, 2, 0);float: left;
}
.one-rr{margin: 5px 5px 5px 5px;width: 142px;height: 30px;background: rgba(2, 2, 2, 0);/* 	border-radius: 3px 3px 3px 3px;border:1px solid #222; */float: left;font-size: 18px;font-family: 'Microsoft Yahei';}.one-rr a:link,
.one-rr a:visited {color: #222;background:url(../img/registerb.png) np-repeat;text-decoration: none;
}.one-rr a:hover {color: #222;text-decoration: none;background: url(../img/register.png) no-repeat;
}
.error{list-style-type: none;color:red;
}

新建text目录、img目录。

在src目录下创建三个java类,CreateImageAction.java,MusicTableAction.java,UserTable.java。

CreateImageAction.java

package action;import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.Random;import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;import org.apache.struts2.ServletActionContext;import com.opensymphony.xwork2.ActionSupport;public class CreateImageAction extends ActionSupport {private ByteArrayInputStream inputStream;private static int WIDTH = 142;private static int HEIGHT = 38;public ByteArrayInputStream getInputStream() {return inputStream;}public void setInputStream(ByteArrayInputStream inputStream) {this.inputStream = inputStream;}private static String createRandom() {String str = "0123456789qwertyuiopasdfghjklzxcvbnm";char[] rands = new char[4];Random random = new Random();for (int i = 0; i < 4; i++) {rands[i] = str.charAt(random.nextInt(36));}return new String(rands);}private void drawBackground(Graphics g) {// 画背景g.setColor(new Color(166,212,175));g.fillRect(0, 0, WIDTH, HEIGHT);// 随机产生 120 个干扰点for (int i = 0; i < 120; i++) {int x = (int) (Math.random() * WIDTH);int y = (int) (Math.random() * HEIGHT);int red = (int) (Math.random() * 255);int green = (int) (Math.random() * 255);int blue = (int) (Math.random() * 255);g.setColor(new Color(red, green, blue));g.drawOval(x, y, 1, 0);}}private void drawRands(Graphics g, String rands) {g.setColor(new Color(42,76,43));g.setFont(new Font(null,  Font.BOLD, 40));// 在不同的高度上输出验证码的每个字符g.drawString("" + rands.charAt(0), 5, 30);g.drawString("" + rands.charAt(1), 35, 30);g.drawString("" + rands.charAt(2), 65, 30);g.drawString("" + rands.charAt(3), 95, 30);System.out.println(rands);}public String execute() throws Exception {HttpServletResponse response = ServletActionContext.getResponse();// 设置浏览器不要缓存此图片response.setHeader("Pragma", "no-cache");response.setHeader("Cache-Control", "no-cache");response.setDateHeader("Expires", 0);String rands = createRandom();BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);Graphics g = image.getGraphics();// 产生图像drawBackground(g);drawRands(g, rands);// 结束图像 的绘制 过程, 完成图像g.dispose();ByteArrayOutputStream outputStream = new ByteArrayOutputStream();ImageIO.write(image, "jpeg", outputStream);ByteArrayInputStream input = new ByteArrayInputStream(outputStream.toByteArray());this.setInputStream(input);HttpSession session = ServletActionContext.getRequest().getSession();session.setAttribute("checkCode", rands);input.close();outputStream.close();return SUCCESS;}
}

MusicTableAction.java

package action;import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;import org.apache.struts2.ServletActionContext;
import org.hibernate.Query;
import org.hibernate.Session;import com.opensymphony.xwork2.ActionSupport;import bean.MusicTable;
import config.HibernateSessionFactory;
import method.CreateTxt;
import method.ListToString;public class MusicTableAction extends ActionSupport {private MusicTable music;private List<MusicTable> list;private List<Object[]> list3;private char s = 's';private int pageNum;private int totalpage;private int pageSize = 6;private int Amount;private InputStream fileInputStream;private String downloadfileName;private String tdfn;// truedownloadfilename哈哈哈哈private int pageNum1;private int totalpage1;private int pageSize1 = 6;private int Amount1;private int pageNum2;private int totalpage2;private int pageSize2 = 6;private int Amount2;private int pageNum3;private int totalpage3;private int pageSize3 = 6;private int Amount3;private int pageNum4;private int totalpage4;private int pageSize4 = 6;private int Amount4;private int pageNum5;private int totalpage5;private int pageSize5 = 6;private int Amount5;private int pageNum6;private int totalpage6;private int pageSize6 = 6;private int Amount6;private File upload;private String uploadFileName;private String truepath;private String name;private String keyString;// 对MusicTable的分页查询public String find() {System.out.println("进入find成功!");Amount = getAmount();this.totalpage = Amount % pageSize == 0 ? (Amount / pageSize) : (Amount / pageSize + 1);if (pageNum <= 0) {this.pageNum = 1;}if (pageNum > totalpage) {this.pageNum = totalpage;}Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "from MusicTable";Query query = session.createQuery(hql);query.setFirstResult(((pageNum - 1) * pageSize));query.setMaxResults(pageSize);list = query.list();System.out.println(list);session.getTransaction().commit();session.close();return "success";}// 查询按localpublic String local() {System.out.println("进入local成功!");Amount1 = getAmount1();this.totalpage1 = Amount1 % pageSize1 == 0 ? (Amount1 / pageSize1) : (Amount1 / pageSize1 + 1);if (pageNum1 <= 0) {this.pageNum1 = 1;}if (pageNum1 > totalpage1) {this.pageNum1 = totalpage1;}Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("from MusicTable where songarea = ?");query.setFirstResult(((pageNum1 - 1) * pageSize1));query.setMaxResults(pageSize1);query.setParameter(0, "内地");list = query.list();session.getTransaction().commit();session.close();return SUCCESS;}// 查询按hongkongpublic String hongkong() {System.out.println("进入hongkong成功!");Amount2 = getAmount2();this.totalpage2 = Amount2 % pageSize2 == 0 ? (Amount2 / pageSize2) : (Amount2 / pageSize2 + 1);if (pageNum2 <= 0) {this.pageNum2 = 1;}if (pageNum2 > totalpage2) {this.pageNum2 = totalpage2;}Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("from MusicTable where songarea = ?");query.setFirstResult(((pageNum2 - 1) * pageSize2));query.setMaxResults(pageSize2);query.setParameter(0, "港台");list = query.list();session.getTransaction().commit();session.close();return SUCCESS;}// 查询按usapublic String usa() {System.out.println("进入usa成功!");Amount3 = getAmount3();this.totalpage3 = Amount3 % pageSize3 == 0 ? (Amount3 / pageSize3) : (Amount3 / pageSize3 + 1);if (pageNum3 <= 0) {this.pageNum3 = 1;}if (pageNum3 > totalpage3) {this.pageNum3 = totalpage3;}Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("from MusicTable where songarea = ?");query.setFirstResult(((pageNum3 - 1) * pageSize3));query.setMaxResults(pageSize3);query.setParameter(0, "欧美");list = query.list();session.getTransaction().commit();session.close();return SUCCESS;}// 查询按japanpublic String japan() {System.out.println("进入japan成功!");Amount4 = getAmount4();this.totalpage4 = Amount4 % pageSize4 == 0 ? (Amount4 / pageSize4) : (Amount4 / pageSize4 + 1);if (pageNum4 <= 0) {this.pageNum4 = 1;}if (pageNum4 > totalpage4) {this.pageNum4 = totalpage4;}Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("from MusicTable where songarea = ?");query.setFirstResult(((pageNum4 - 1) * pageSize4));query.setMaxResults(pageSize4);query.setParameter(0, "日本");list = query.list();session.getTransaction().commit();session.close();return SUCCESS;}// 查询按koreapublic String korea() {System.out.println("进入korea成功!");Amount5 = getAmount5();this.totalpage5 = Amount5 % pageSize5 == 0 ? (Amount5 / pageSize5) : (Amount5 / pageSize5 + 1);if (pageNum5 <= 0) {this.pageNum5 = 1;}if (pageNum5 > totalpage5) {this.pageNum5 = totalpage5;}Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("from MusicTable where songarea = ?");query.setFirstResult(((pageNum5 - 1) * pageSize5));query.setMaxResults(pageSize5);query.setParameter(0, "韩国");list = query.list();session.getTransaction().commit();session.close();return SUCCESS;}// 添加public String upload() throws Exception {System.out.println("进入upload成功!");String path = ServletActionContext.getServletContext().getRealPath("/");InputStream is = new FileInputStream(upload);String ext = uploadFileName.substring(uploadFileName.lastIndexOf("."));name = System.currentTimeMillis() + ext;OutputStream os = new FileOutputStream(path + "img/" + name);byte buffer[] = new byte[1024];int count = 0;while ((count = is.read(buffer)) > 0) {os.write(buffer, 0, count);}os.close();is.close();Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("select id from MusicTable");MusicTable music1 = new MusicTable();music1.setUploader(music.getUploader());music1.setSongtitle(music.getSongtitle());music1.setSinger(music.getSinger());music1.setSongimg(name);music1.setAudiolength(music.getAudiolength());music1.setSongarea(music.getSongarea());session.save(music1);session.getTransaction().commit();session.close();return SUCCESS;}// 下载歌单public String download() {System.out.println("进入download成功!");String pathdw = ServletActionContext.getServletContext().getRealPath("/");File file = new File(pathdw + "/text/" + getTdfn());downloadfileName = file.getName();// 获取文件名try {fileInputStream = new FileInputStream(file);} catch (FileNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}return SUCCESS;}// 对musicTable的投影查询根据idpublic String createMusicList() {System.out.println("进入createMusicList成功!");Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("select new List(id,songtitle,singer,uploader,audiolength,songarea) from MusicTable music");list3 = query.list();CreateTxt createTxt = new CreateTxt();ListToString listToString = new ListToString();Date d = new Date();System.out.println(d);SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");String dateNowStr = sdf.format(d);System.out.println(dateNowStr);try {createTxt.creatTxtFile(dateNowStr + "SongList");tdfn = dateNowStr + "SongList.txt";createTxt.writeTxtFile(listToString.listToString(list3, s));} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}session.getTransaction().commit();session.close();return "success";}// 删除前public String predel() {return SUCCESS;}// 删除public String del() {System.out.println("进入del成功!");Session session = HibernateSessionFactory.getSession();session.beginTransaction();MusicTable music2 = (MusicTable) session.load(MusicTable.class, music.getId());session.delete(music2);session.getTransaction().commit();session.close();return SUCCESS;}// 修改前public String preupdate() {Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "select songtitle,singer,songimg,songarea from MusicTable where id=" + music.getId();Query query = session.createQuery(hql);list = query.list();for (Iterator iter = list.iterator(); iter.hasNext();) {Object[] obj = (Object[]) iter.next();music.setSongtitle((String) obj[0]);music.setSinger((String) obj[1]);music.setSongarea((String) obj[3]);}session.getTransaction().commit();session.close();return SUCCESS;}// 修改public String update() {System.out.println("进入update成功!");Session session = HibernateSessionFactory.getSession();session.beginTransaction();MusicTable music3 = (MusicTable) session.load(MusicTable.class, music.getId());music3.setSongtitle(music.getSongtitle());music3.setSinger(music.getSinger());music3.setSongarea(music.getSongarea());session.update(music3);session.getTransaction().commit();session.close();return SUCCESS;}// 按查询关键字public String search() {System.out.println("进入search成功!");Amount6 = getAmount6();this.totalpage6 = Amount6 % pageSize6 == 0 ? (Amount6 / pageSize6) : (Amount6 / pageSize6 + 1);if (pageNum6 <= 0) {this.pageNum6 = 1;}if (pageNum6 > totalpage6) {this.pageNum6 = totalpage6;}Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("from MusicTable where songtitle like ?");query.setFirstResult(((pageNum6 - 1) * pageSize6));query.setMaxResults(pageSize6);query.setParameter(0, "%" + getKeyString() + "%");list = query.list();session.getTransaction().commit();session.close();return SUCCESS;}// getters and setterspublic MusicTable getMusic() {return music;}public void setMusic(MusicTable music) {this.music = music;}public List<MusicTable> getList() {return list;}public void setList(List<MusicTable> list) {this.list = list;}public int getPageNum() {return pageNum;}public void setPageNum(int pageNum) {this.pageNum = pageNum;}public int getTotalpage() {return totalpage;}public void setTotalpage(int totalpage) {this.totalpage = totalpage;}public int getPageSize() {return pageSize;}public void setPageSize(int pageSize) {this.pageSize = pageSize;}public int getAmount() {int i = 0;Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "select count(*) from MusicTable";Query query = session.createQuery(hql);// 2、获取结果(结果为long类型)Object obj = query.uniqueResult();// 3、转化为long(类型为long,转为int会报错)Long long1 = (Long) obj;i = long1.intValue();session.getTransaction().commit();session.close();return i;}public int getAmount1() {int i = 0;Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "select count(*) from MusicTable where songarea = '内地'";Query query = session.createQuery(hql);// 2、获取结果(结果为long类型)Object obj = query.uniqueResult();// 3、转化为long(类型为long,转为int会报错)Long long1 = (Long) obj;i = long1.intValue();session.getTransaction().commit();session.close();return i;}public int getAmount2() {int i = 0;Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "select count(*) from MusicTable where songarea = '港台'";Query query = session.createQuery(hql);// 2、获取结果(结果为long类型)Object obj = query.uniqueResult();// 3、转化为long(类型为long,转为int会报错)Long long1 = (Long) obj;i = long1.intValue();session.getTransaction().commit();session.close();return i;}public int getAmount3() {int i = 0;Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "select count(*) from MusicTable where songarea = '欧美'";Query query = session.createQuery(hql);// 2、获取结果(结果为long类型)Object obj = query.uniqueResult();// 3、转化为long(类型为long,转为int会报错)Long long1 = (Long) obj;i = long1.intValue();session.getTransaction().commit();session.close();return i;}public int getAmount4() {int i = 0;Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "select count(*) from MusicTable where songarea = '日本'";Query query = session.createQuery(hql);// 2、获取结果(结果为long类型)Object obj = query.uniqueResult();// 3、转化为long(类型为long,转为int会报错)Long long1 = (Long) obj;i = long1.intValue();session.getTransaction().commit();session.close();return i;}public int getAmount5() {int i = 0;Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "select count(*) from MusicTable where songarea = '韩国'";Query query = session.createQuery(hql);// 2、获取结果(结果为long类型)Object obj = query.uniqueResult();// 3、转化为long(类型为long,转为int会报错)Long long1 = (Long) obj;i = long1.intValue();session.getTransaction().commit();session.close();return i;}public void setAmount(int amount) {Amount = amount;}public int getPageNum1() {return pageNum1;}public void setPageNum1(int pageNum1) {this.pageNum1 = pageNum1;}public int getTotalpage1() {return totalpage1;}public void setTotalpage1(int totalpage1) {this.totalpage1 = totalpage1;}public int getPageSize1() {return pageSize1;}public void setPageSize1(int pageSize1) {this.pageSize1 = pageSize1;}public int getPageNum2() {return pageNum2;}public void setPageNum2(int pageNum2) {this.pageNum2 = pageNum2;}public int getTotalpage2() {return totalpage2;}public void setTotalpage2(int totalpage2) {this.totalpage2 = totalpage2;}public int getPageSize2() {return pageSize2;}public void setPageSize2(int pageSize2) {this.pageSize2 = pageSize2;}public int getPageNum3() {return pageNum3;}public void setPageNum3(int pageNum3) {this.pageNum3 = pageNum3;}public int getTotalpage3() {return totalpage3;}public void setTotalpage3(int totalpage3) {this.totalpage3 = totalpage3;}public int getPageSize3() {return pageSize3;}public void setPageSize3(int pageSize3) {this.pageSize3 = pageSize3;}public int getPageNum4() {return pageNum4;}public void setPageNum4(int pageNum4) {this.pageNum4 = pageNum4;}public int getTotalpage4() {return totalpage4;}public void setTotalpage4(int totalpage4) {this.totalpage4 = totalpage4;}public int getPageSize4() {return pageSize4;}public void setPageSize4(int pageSize4) {this.pageSize4 = pageSize4;}public int getPageNum5() {return pageNum5;}public void setPageNum5(int pageNum5) {this.pageNum5 = pageNum5;}public int getTotalpage5() {return totalpage5;}public void setTotalpage5(int totalpage5) {this.totalpage5 = totalpage5;}public int getPageSize5() {return pageSize5;}public void setPageSize5(int pageSize5) {this.pageSize5 = pageSize5;}public void setAmount1(int amount1) {Amount1 = amount1;}public void setAmount2(int amount2) {Amount2 = amount2;}public void setAmount3(int amount3) {Amount3 = amount3;}public void setAmount4(int amount4) {Amount4 = amount4;}public void setAmount5(int amount5) {Amount5 = amount5;}public String getKeyString() {return keyString;}public void setKeyString(String keyString) {this.keyString = keyString;}public int getAmount6() {int i = 0;Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "select count(*) from MusicTable where songtitle like ?";Query query = session.createQuery(hql);query.setParameter(0, "%" + getKeyString() + "%");// 2、获取结果(结果为long类型)Object obj = query.uniqueResult();// 3、转化为long(类型为long,转为int会报错)Long long1 = (Long) obj;i = long1.intValue();session.getTransaction().commit();session.close();return i;}public int getPageNum6() {return pageNum6;}public void setPageNum6(int pageNum6) {this.pageNum6 = pageNum6;}public int getTotalpage6() {return totalpage6;}public void setTotalpage6(int totalpage6) {this.totalpage6 = totalpage6;}public int getPageSize6() {return pageSize6;}public void setPageSize6(int pageSize6) {this.pageSize6 = pageSize6;}public void setAmount6(int amount6) {Amount6 = amount6;}public File getUpload() {return upload;}public void setUpload(File upload) {this.upload = upload;}public String getUploadFileName() {return uploadFileName;}public void setUploadFileName(String uploadFileName) {this.uploadFileName = uploadFileName;}public String getTruepath() {return truepath;}public void setTruepath(String truepath) {this.truepath = truepath;}public String getName() {return name;}public void setName(String name) {this.name = name;}public List<Object[]> getList3() {return list3;}public void setList3(List<Object[]> list3) {this.list3 = list3;}public char getS() {return s;}public void setS(char s) {this.s = s;}public InputStream getFileInputStream() {return fileInputStream;}public void setFileInputStream(InputStream fileInputStream) {this.fileInputStream = fileInputStream;}public String getDownloadfileName() {return downloadfileName;}public void setDownloadfileName(String downloadfileName) {this.downloadfileName = downloadfileName;}public String getTdfn() {return tdfn;}public void setTdfn(String tdfn) {this.tdfn = tdfn;}}

UserTable.java

package action;import java.util.List;
import java.util.Map;import javax.servlet.http.HttpSession;import org.apache.struts2.ServletActionContext;
import org.hibernate.Query;
import org.hibernate.Session;import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;import bean.UserTable;
import config.HibernateSessionFactory;public class UserTableAction extends ActionSupport {private UserTable user;private List<UserTable> list2;private String checkCode;// 登录public String login() {System.out.println("进入login成功!");HttpSession session2 = ServletActionContext.getRequest().getSession();boolean validated = false;String usr = user.getUsername();String pwd = user.getPassword();String checkCode2 = (String) session2.getAttribute("checkCode");Session session = HibernateSessionFactory.getSession();session.beginTransaction();String hql = "from UserTable WHERE username = ? AND password = ?";try {System.out.println(checkCode2);List<UserTable> listx = session.createQuery(hql).setString(0, usr).setString(1, pwd).list();if (usr.equals(listx.get(0)) && pwd.equals(listx.get(1)) && checkCode.equals(checkCode2))validated = true;ActionContext actionContext = ActionContext.getContext();Map<String, Object> map = actionContext.getSession();map.put(usr, user);session.getTransaction().commit();session.close();return SUCCESS;} catch (Exception e) {return INPUT;}}// 注册public String register() {System.out.println("进入register成功!");Session session = HibernateSessionFactory.getSession();session.beginTransaction();Query query = session.createQuery("select id from UserTable");UserTable user1 = new UserTable();user1.setUsername(user.getUsername());user1.setPassword(user.getPassword());user1.setSex(user.getSex());user1.setEmail(user.getEmail());user1.setBirthday(user.getBirthday());user1.setIdnumber(user.getIdnumber());user1.setQualify(user.getQualify());session.save(user1);session.getTransaction().commit();session.close();return SUCCESS;}//登出public String logout(){System.out.println("进入logout成功!");ActionContext actionContext = ActionContext.getContext();Map<String, Object> map = actionContext.getSession();map.remove(user);return SUCCESS;}// getters and setterspublic UserTable getUser() {return user;}public void setUser(UserTable user) {this.user = user;}public List<UserTable> getList2() {return list2;}public void setList2(List<UserTable> list2) {this.list2 = list2;}public String getCheckCode() {return checkCode;}public void setCheckCode(String checkCode) {this.checkCode = checkCode;}}

在同目录下创建验证xml文件:UserTableAction-login-validation.xml,UserTableAction-register-validation.xml。

UserTableAction-login-validation.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC"-//Apache Struts//XWork Validator 1.0.3//EN""http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"><validators><!-- 检验username属性 --><field name="user.username"><!-- 验证字符串不能为空,即必填 --><field-validator type="requiredstring"><!-- 去空格 --><param name="trim">true</param><!-- 错误信息提示 --><message>请输入姓名</message></field-validator><!-- 指定name属性必须匹配的正则表达式 --><field-validator type="regex"><param name="expression"><![CDATA[(\w{4,20})]]></param><!-- 错误信息提示 --><message>您输入的姓名只能是字母和数字,且长度在4到20之间</message></field-validator></field><!-- 检验password属性 --><field name="user.password"><!-- 指定password属性必须满足必填规则 --><field-validator type="requiredstring"><param name="trim">true</param><!-- 错误信息提示 --><message>请输入密码</message></field-validator><!-- 指定password属性必须匹配的正则表达式 --><field-validator type="regex"><param name="expression"><![CDATA[(\w{6})]]></param><!-- 错误信息提示 --><message>您输入的密码必须为六位数字</message></field-validator></field><field name="checkCode"><field-validator type="requiredstring"><message>请输入验证码</message></field-validator><field-validator type="validationCodeValidator"><param name="checkCode">#session.checkCode</param><message>验证码不正确</message></field-validator></field></validators>

UserTableAction-register-validation.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC"-//Apache Struts//XWork Validator 1.0.3//EN""http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
<validators><!-- 检验username属性 --><field name="user.username"><!-- 验证字符串不能为空,即必填 --><field-validator type="requiredstring"><!-- 去空格 --><param name="trim">true</param><!-- 错误信息提示 --><message>请输入姓名</message></field-validator><field-validator type="stringlength"><param name="minLength">4</param><param name="maxLength">16</param><param name="trim">true</param><message>用户名必须为${minLength}至${maxLength}个字符!,当前为${user.username}</message></field-validator></field><!-- 检验password属性 --><field name="user.password"><!-- 指定password属性必须满足必填规则 --><field-validator type="requiredstring"><param name="trim">true</param><!-- 错误信息提示 --><message>请输入密码</message></field-validator><field-validator type="stringlength"><!--去掉前后的空格 --><param name="trim">true</param><param name="minLength">6</param><param name="maxLength">20</param><message>密码必须为${minLength}至${maxLength}个字符,当前为${user.password}</message></field-validator></field><!-- 检验email属性 --><field name="user.email"><!-- 验证字符串不能为空,即必填 --><field-validator type="requiredstring"><!-- 去空格 --><param name="trim">true</param><!-- 错误信息提示 --><message>请输入邮箱地址!</message></field-validator><field-validator type="email"><param name="expression"><![CDATA[(\w{6})]]></param><!-- 错误信息提示 --><message>必须输入有效的电子邮件地址!</message></field-validator></field><!-- 检验idnumber属性 --><field name="user.idnumber"><field-validator type="stringlength"><!-- 长度最小值 --><param name="minLength">18</param><!-- 长度最大值 --><param name="minLength">18</param><!-- 错误信息提示 --><message>身份证号必须为18位!</message></field-validator></field></validators>

修改struts.xml如下

<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN""http://struts.apache.org/dtds/struts-2.5.dtd"><struts><package name="default" extends="struts-default"><!-- ··························upload(add)·························· --><action name="upload" class="action.MusicTableAction" method="upload"><result name="success" type="chain"><param name="actionName">find</param></result></action><!-- ··························下载·························· --><action name="download" class="action.MusicTableAction" method="download"><result type="stream"><param name="contentType">application/octet-stream</param><param name="inputName">fileInputStream</param><param name="contentDisposition">attachment;filename="${downloadfileName}"</param><param name="bufferSize">1024</param></result></action><!-- ··························createMusicList·························· --><action name="createMusicList" class="action.MusicTableAction" method="createMusicList"><result name="success" type="chain"><param name="actionName">download</param></result></action><!-- ··························predel·························· --><action name="predel" class="action.MusicTableAction" method="predel"><result name="success"><param name="location">/del.jsp</param><param name="song.id">${music.id}</param></result></action><!-- ··························del·························· --><action name="del" class="action.MusicTableAction" method="del"><result name="success" type="chain"><param name="actionName">find</param><param name="song.id">${music.id}</param></result></action><!-- ··························preupdate·························· --><action name="preupdate" class="action.MusicTableAction"method="preupdate"><result name="success"><param name="location">/update.jsp</param></result></action><!-- ··························update·························· --><action name="update" class="action.MusicTableAction" method="update"><result name="success" type="chain"><param name="actionName">find</param></result></action><!-- ··························login·························· --><action name="login" class="action.UserTableAction" method="login"><result name="success" type="chain"><param name="actionName">find</param><param name="username">${username}</param></result><result name="error"><param name="location">/error.jsp</param></result><result name="input">/login.jsp</result></action><!-- ··························register·························· --><action name="register" class="action.UserTableAction" method="register"><result name="success">/registersucc.jsp</result><result name="input">/register.jsp</result></action><!-- ··························logout·························· --><action name="logout" class="action.MusicTableAction" method="logout"><result name="success"><param name="location">/login.jsp</param></result></action><!-- ··························find·························· --><action name="find" class="action.MusicTableAction" method="find"><result name="success"><param name="location">/main.jsp</param></result></action><!-- ··························local·························· --><action name="local" class="action.MusicTableAction" method="local"><result name="success"><param name="location">/local.jsp</param></result></action><!-- ··························hongkong·························· --><action name="hongkong" class="action.MusicTableAction" method="hongkong"><result name="success"><param name="location">/hongkong.jsp</param></result></action><!-- ··························usa·························· --><action name="usa" class="action.MusicTableAction" method="usa"><result name="success"><param name="location">/usa.jsp</param></result></action><!-- ··························japan·························· --><action name="japan" class="action.MusicTableAction" method="japan"><result name="success"><param name="location">/japan.jsp</param></result></action><!-- ··························korea·························· --><action name="korea" class="action.MusicTableAction" method="korea"><result name="success"><param name="location">/korea.jsp</param></result></action><!-- ··························search·························· --><action name="search" class="action.MusicTableAction" method="search"><result name="success"><param name="location">/result.jsp</param></result></action><!-- ··························createImageAction·························· --><action name="createImageAction" class="action.CreateImageAction"><result name="success" type="stream"><param name="contentType">image/jpeg</param><param name="inputName">inputStream</param></result></action></package><constant name="struts.i18n.encoding" value="UTF-8"></constant>
</struts>

在method目录下新建两个类,CreateTxt.java,ListToString.java。

CreateTxt.java

package method;import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;import org.apache.struts2.ServletActionContext;import action.MusicTableAction;public class CreateTxt {private String textpath;private static String filenameTemp;public boolean creatTxtFile(String name) throws IOException {boolean flag = false;filenameTemp = getTextpath() + name + ".txt";File filename = new File(filenameTemp);if (!filename.exists()) {filename.createNewFile();flag = true;}return flag;}public static boolean writeTxtFile(String newStr) throws IOException {// 先读取原有文件内容,然后进行写入操作boolean flag = false;String filein = newStr + "\r\n";String temp = "";FileInputStream fis = null;InputStreamReader isr = null;BufferedReader br = null;FileOutputStream fos = null;PrintWriter pw = null;try {// 文件路径File file = new File(filenameTemp);// 将文件读入输入流fis = new FileInputStream(file);isr = new InputStreamReader(fis);br = new BufferedReader(isr);StringBuffer buf = new StringBuffer();// 保存该文件原有的内容for (int j = 1; (temp = br.readLine()) != null; j++) {buf = buf.append(temp);// System.getProperty("line.separator")// 行与行之间的分隔符 相当于“\n”buf = buf.append(System.getProperty("line.separator"));}buf.append(filein);fos = new FileOutputStream(file);pw = new PrintWriter(fos);pw.write(buf.toString().toCharArray());pw.flush();flag = true;} catch (IOException e1) {// TODO 自动生成 catch 块throw e1;} finally {if (pw != null) {pw.close();}if (fos != null) {fos.close();}if (br != null) {br.close();}if (isr != null) {isr.close();}if (fis != null) {fis.close();}}return flag;}public String getTextpath() {System.out.println("这里是getTextpath!");String p = ServletActionContext.getServletContext().getRealPath("/");String q = p+"text/";System.out.println(q);return q;}public void setTextpath(String textpath) {this.textpath = textpath;}}

ListToString.java

package method;import java.util.List;public class ListToString {public String listToString(List<Object[]> list, char separator) {StringBuilder sb = new StringBuilder();for (int i = 0; i < list.size(); i++) {sb.append(list.get(i));if (i < list.size() - 1) {sb.append(separator);}}return sb.toString();}}

至此,项目建立完成,可发布至tomcat,并启动chrome查看。

这篇关于歌单管理系统——小型javaweb项目的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/178746

相关文章

Java编译生成多个.class文件的原理和作用

《Java编译生成多个.class文件的原理和作用》作为一名经验丰富的开发者,在Java项目中执行编译后,可能会发现一个.java源文件有时会产生多个.class文件,从技术实现层面详细剖析这一现象... 目录一、内部类机制与.class文件生成成员内部类(常规内部类)局部内部类(方法内部类)匿名内部类二、

SpringBoot实现数据库读写分离的3种方法小结

《SpringBoot实现数据库读写分离的3种方法小结》为了提高系统的读写性能和可用性,读写分离是一种经典的数据库架构模式,在SpringBoot应用中,有多种方式可以实现数据库读写分离,本文将介绍三... 目录一、数据库读写分离概述二、方案一:基于AbstractRoutingDataSource实现动态

Springboot @Autowired和@Resource的区别解析

《Springboot@Autowired和@Resource的区别解析》@Resource是JDK提供的注解,只是Spring在实现上提供了这个注解的功能支持,本文给大家介绍Springboot@... 目录【一】定义【1】@Autowired【2】@Resource【二】区别【1】包含的属性不同【2】@

springboot循环依赖问题案例代码及解决办法

《springboot循环依赖问题案例代码及解决办法》在SpringBoot中,如果两个或多个Bean之间存在循环依赖(即BeanA依赖BeanB,而BeanB又依赖BeanA),会导致Spring的... 目录1. 什么是循环依赖?2. 循环依赖的场景案例3. 解决循环依赖的常见方法方法 1:使用 @La

Java枚举类实现Key-Value映射的多种实现方式

《Java枚举类实现Key-Value映射的多种实现方式》在Java开发中,枚举(Enum)是一种特殊的类,本文将详细介绍Java枚举类实现key-value映射的多种方式,有需要的小伙伴可以根据需要... 目录前言一、基础实现方式1.1 为枚举添加属性和构造方法二、http://www.cppcns.co

Elasticsearch 在 Java 中的使用教程

《Elasticsearch在Java中的使用教程》Elasticsearch是一个分布式搜索和分析引擎,基于ApacheLucene构建,能够实现实时数据的存储、搜索、和分析,它广泛应用于全文... 目录1. Elasticsearch 简介2. 环境准备2.1 安装 Elasticsearch2.2 J

Java中的String.valueOf()和toString()方法区别小结

《Java中的String.valueOf()和toString()方法区别小结》字符串操作是开发者日常编程任务中不可或缺的一部分,转换为字符串是一种常见需求,其中最常见的就是String.value... 目录String.valueOf()方法方法定义方法实现使用示例使用场景toString()方法方法

Java中List的contains()方法的使用小结

《Java中List的contains()方法的使用小结》List的contains()方法用于检查列表中是否包含指定的元素,借助equals()方法进行判断,下面就来介绍Java中List的c... 目录详细展开1. 方法签名2. 工作原理3. 使用示例4. 注意事项总结结论:List 的 contain

Java实现文件图片的预览和下载功能

《Java实现文件图片的预览和下载功能》这篇文章主要为大家详细介绍了如何使用Java实现文件图片的预览和下载功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... Java实现文件(图片)的预览和下载 @ApiOperation("访问文件") @GetMapping("

Spring Boot + MyBatis Plus 高效开发实战从入门到进阶优化(推荐)

《SpringBoot+MyBatisPlus高效开发实战从入门到进阶优化(推荐)》本文将详细介绍SpringBoot+MyBatisPlus的完整开发流程,并深入剖析分页查询、批量操作、动... 目录Spring Boot + MyBATis Plus 高效开发实战:从入门到进阶优化1. MyBatis