--
Jsp(Java Web)创建网页桌面快捷方式
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/**
* Servlet下载文件
*/
protected
void
dowFile(){
//获得请求文件名
String filename =
"dowFile.url"
;
//设置文件MIME类型
response.setContentType(
"application/octet-stream"
);
//设置Content-Disposition
response.setHeader(
"Content-Disposition"
,
"attachment;filename="
+filename);
//读取目标文件,通过response将目标文件写到客户端
//获取目标文件的绝对路径
String fullFileName = getServletContext().getRealPath(
"/download/"
+ filename);
//System.out.println(fullFileName);
//读取文件
InputStream in =
new
FileInputStream(fullFileName);
OutputStream out = response.getOutputStream();
//写文件
int
b;
while
((b=in.read())!= -
1
)
{
out.write(b);
}
in.close();
out.close();
}
|
记录于:2015年8月7号 10:40周三
JS日期、日期时间正则表达式
1
2
3
4
5
6
7
8
9
|
var
reg = /^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/;
var
regHMS = /^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})([ \t\n\x0B\f\r])(([0-1]{1}[0-9]
{1})|([2]{1}[0-4]{1}))([:])(([0-5]{1}[0-9]{1}|[6]{1}[0]{1}))$/;
if
($(
this
).val()!=
""
){
if
(!reg.test($(
this
).val())&&!regHMS.test($(
this
).val())){
alert(
"请输入正确的日期,例如:2015-4-16"
);
$(
this
).focus();
}
}
|
记录于:2015年5月27号 15:01周三
经典的ctx
1
|
<
c:set
var
=
"ctx"
value
=
"${pageContext.request.contextPath}"
/>
|
记录于:2015年3月26号 10:44 周四
PDF转换神器
http://www.pc6.com/softview/SoftView_17109.html
记录于:2015年7月10号 16:00 周五
本文转自 沫沫金 51CTO博客,原文链接:xxxhttp://blog.51cto.com/zl0828/1624576xxxx,如需转载请自行联系原作者