package Pluto;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
import javax.activation.FileTypeMap;
public class function {
public function() {
}
public static boolean isInvalid(String value) {
return (value == null || value.length() == 0);
}
public static String page(int page_num, int cur_page, int per_group,
String base_url) {
String page_val = "";
int /* group_num, */cur_group, from, to, a, next, prev;
base_url += (base_url.indexOf('?') != -1) ? '&' : '?';
if (page_num < 1) {
return page_val;
} else if (page_num == 1) {
return page_val = "1";
}
if ((cur_page - 1) % (per_group - 1) == 0) { // ��������һҳ
cur_group = (cur_page - 1) / (per_group - 1) + 1;
} else {
cur_group = (int) Math.ceil((double) (cur_page - 1)
/ (per_group - 1));
}
from = (cur_group - 1) * (per_group - 1) + 1;
from = cur_group <= 1 ? 1 : from;
to = from + per_group;
to = to > page_num ? page_num + 1 : to;
for (a = from; a < to; a++) {
if (a != cur_page) {
page_val += "<a href =javascript:dopage('" + base_url + "page="
+ String.valueOf(a) + "');>" + String.valueOf(a) + "</a>";
} else {
page_val += "<span class=\"current\">" + String.valueOf(a)
+ "</span>";
}
}
next = cur_page + 1;
prev = cur_page - 1;
if (cur_page != page_num) {
page_val += "<a href =javascript:dopage('" + base_url + "page=" + String.valueOf(next)
+ "');> Next </a>";
page_val += "<a href =javascript:dopage('" + base_url + "page="
+ String.valueOf(page_num) + "');> >> </a>";
}
if (cur_page != 1) {
page_val = "<a href =javascript:dopage('" + base_url + "page=" + prev + "');> Prev </a>"
+ page_val;
page_val = "<a href =javascript:dopage('" + base_url + "page=1');> << </a>" + page_val; // ��ҳ
}
return page_val;
}
public static String page(int page_num, int cur_page, int per_group,
String base_url,boolean noAJAX) {
String page_val = "";
int /* group_num, */cur_group, from, to, a, next, prev;
base_url += (base_url.indexOf('?') != -1) ? '&' : '?';
if (page_num < 1) {
return page_val;
} else if (page_num == 1) {
return page_val = "1";
}
if ((cur_page - 1) % (per_group - 1) == 0) { // ��������һҳ
cur_group = (cur_page - 1) / (per_group - 1) + 1;
} else {
cur_group = (int) Math.ceil((double) (cur_page - 1)
/ (per_group - 1));
}
from = (cur_group - 1) * (per_group - 1) + 1;
from = cur_group <= 1 ? 1 : from;
to = from + per_group;
to = to > page_num ? page_num + 1 : to;
for (a = from; a < to; a++) {
if (a != cur_page) {
page_val += "<a href =" + base_url + "page="
+ String.valueOf(a) + ">" + String.valueOf(a) + "</a>";
} else {
page_val += "<span class=\"current\">" + String.valueOf(a)
+ "</span>";
}
}
next = cur_page + 1;
prev = cur_page - 1;
if (cur_page != page_num) {
page_val += "<a href =" + base_url + "page=" + String.valueOf(next)
+ "> Next </a>";
page_val += "<a href =" + base_url + "page="
+ String.valueOf(page_num) + "> >> </a>";
}
if (cur_page != 1) {
page_val = "<a href =" + base_url + "page=" + prev + "> Prev </a>"
+ page_val;
page_val = "<a href =" + base_url + "page=1> << </a>" + page_val;
}
return page_val;
}
// MD5����
private final static String[] hexDigits = { "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
public static String byteArrayToHexString(byte[] b) {
StringBuffer resultSb = new StringBuffer();
for (int i = 0; i < b.length; i++) {
resultSb.append(byteToHexString(b[i]));
}
return resultSb.toString();
}
private static String byteToHexString(byte b) {
int n = b;
if (n < 0)
n = 256 + n;
int d1 = n / 16;
int d2 = n % 16;
return hexDigits[d1] + hexDigits[d2];
}
public static String MD5Encode(String origin) {
String resultString = null;
try {
resultString = new String(origin);
MessageDigest md = MessageDigest.getInstance("MD5");
resultString = byteArrayToHexString(md.digest(resultString
.getBytes()));
} catch (Exception ex) {
}
return resultString;
}
public static String PlutoJump(String errorStr, String jumpTo) {
String str = null;
try {
str = "<script language='javascript'>alert('" + errorStr
+ "');location.href='" + jumpTo + "';</script>";
} catch (Exception e) {
str = "<script language='javascript'>alert('" + errorStr
+ "');location.href='" + jumpTo + "';</script>";
}
return str;
}
public static int strToInt(String str) {
int a = 0;
try {
a = Integer.parseInt(str);
} catch (NumberFormatException e) {
a = 0;
}
return a;
}
public static String fileType(File file) {
FileTypeMap map = FileTypeMap.getDefaultFileTypeMap();
return map.getContentType(file);
}
/**
* ��ȡԴ�ļ�����
*
* @param filename
* String �ļ�·��
* @throws IOException
* @return byte[] �ļ�����
*/
public static byte[] readFile(String filename) throws IOException {
File file = new File(filename);
if (filename == null || filename.equals("")) {
throw new NullPointerException("��Ч���ļ�·��");
}
long len = file.length();
byte[] bytes = new byte[(int) len];
BufferedInputStream bufferedInputStream = new BufferedInputStream(
new FileInputStream(file));
int r = bufferedInputStream.read(bytes);
if (r != len)
throw new IOException("��ȡ�ļ�����ȷ");
bufferedInputStream.close();
return bytes;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件)
资源推荐
资源详情
资源评论
收起资源包目录
java期末大作业 基于Java+JSP实现的在线音乐管理系统源码(含SQL数据库文件) (193个子文件)
Escape.class 7KB
function.class 6KB
sendmusic.class 5KB
setbox.class 5KB
upload.class 4KB
uploadmusic.class 4KB
message.class 4KB
creatXML.class 3KB
changepwd.class 3KB
DBConnection.class 3KB
MusicBox.class 3KB
login.class 3KB
login.class 3KB
register.class 3KB
register.class 3KB
delmessage.class 3KB
addComments.class 3KB
link.class 2KB
delmusic.class 2KB
dellink.class 2KB
deluser.class 2KB
logout.class 1KB
.classpath 836B
org.eclipse.wst.common.component 463B
org.eclipse.wst.jsdt.ui.superType.container 49B
control.css 5KB
control.css 5KB
thickbox.css 4KB
niceforms.css 4KB
default.css 4KB
page.css 2KB
css.css 2KB
table.css 1KB
LoadingStatus.css 71B
ajax-loader.gif 11KB
loadingAnimation.gif 6KB
logo.gif 2KB
icon9.gif 1KB
icon8.gif 1KB
icon0.gif 1KB
icon10.gif 1KB
password.gif 1KB
username.gif 1001B
icon5.gif 986B
icon7.gif 934B
icon3.gif 920B
aL.gif 918B
icon4.gif 903B
icon1.gif 858B
icon2.gif 816B
icon6.gif 781B
radio.gif 745B
checkbox.gif 689B
select_right.gif 681B
input_left_xon.gif 567B
select_left.gif 543B
txtarea_tr_xon.gif 506B
txtarea_tr.gif 499B
loginin.gif 392B
txtarea_br_xon.gif 390B
txtarea_br.gif 384B
txtarea_cntr.gif 381B
input_right_xon.gif 353B
input_left.gif 348B
button_right.gif 344B
button_right_xon.gif 340B
input_right.gif 339B
button_left.gif 338B
button_left_xon.gif 336B
select.gif 282B
warning.gif 281B
txtarea_cntr_xon.gif 236B
aR.gif 223B
input_bg.gif 218B
refer.gif 176B
button_bg.gif 166B
txtarea_tl.gif 152B
txtarea_tl_xon.gif 152B
txtarea_bl.gif 150B
txtarea_bl_xon.gif 150B
aM.gif 134B
txtarea_l_xon.gif 100B
txtarea_l.gif 100B
select_bg.gif 96B
img14.gif 88B
img10.gif 88B
img09.gif 82B
img13.gif 43B
blank.gif 43B
struts2-core-2.0.11.1.jar 2.22MB
freemarker-2.3.8.jar 784KB
mysql-connector-java-5.1.6-bin.jar 687KB
xwork-2.0.4.jar 445KB
ognl-2.6.11.jar 164KB
jdom.jar 150KB
commons-io-1.4.jar 106KB
servlet-api.jar 95KB
commons-fileupload-1.2.1.jar 56KB
commons-logging-1.0.4.jar 37KB
jsmartcom_zh_CN.jar 13KB
共 193 条
- 1
- 2
柯晓楠
- 粉丝: 2w+
- 资源: 2847
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页