- 浏览: 28106 次
- 性别:
- 来自: 北京
最新评论
文章列表
/**
* 验证图片文件类型是否符合要求
* @param fileType
* @return
*/
public static boolean checkFileImg(String fileType){
boolean flag = false;
for(String type:imgFileTypes){
if(type.equals(fileType))
flag = true;
}
return flag;
}
/**
* 判断图片文件是否过小
* @param file
* @ ...
//获取文件输出流
FileOutputStream fos = new FileOutputStream(savePath);
/*String newFileName = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ "/"+path+"/" + newName;*/
String fileId=newName.su ...
package com.common.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.Properties;
i ...
生成myeclipse注册码
- 博客分类:
- 其它
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class MyEclipseGen {
private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 19 ...
<div class="head_portrait_b">
<img id="userAvter_pic" src="#" />
</div>
<a href="javascript:void(0)" class="btn_yellow">上传</a>
<div style="width:100px;position:relative; top:-23 ...
if (typeof (HTMLElement) != "undefined" && !window.opera) {
HTMLElement.prototype.__defineGetter__("outerHTML", function() {
var a = this.attributes, str = "<" + this.tagName, i = 0;
for (; i < a.length; i++)
if (a[i].specified)
str += &q ...
import java.util.Locale;
import java.util.ResourceBundle;
public class TestResourceBundle{
//国际化信息
private String name = "name";//
public static void main(String args[])
{
ServletRequest request = ......;
ResourceBundle resource = resourceBundleFilter(request);
na ...
fis = new BufferedInputStream(new FileInputStream(path));
byte[] buffer = new byte[fis.available()];
//byte[] buffer = new byte[1024];
fis.read(buffer);
fis.close();
response.reset();
System.out.println("downloadName---->" + fileName);
fileName = enc ...
/**
* 读取file.properties配置文件中的属性
*
*/
static{
try
{
Properties props = new Properties();
//得到当前类的类加载器,以流的方式读取配置文件
props.load(DownloadFileUtils.class.getClassLoader().getResourceAsStream("file.properties"));
saveFileURL = props. ...
引用
本来想写一个关于解决struts做视频上传下载时,各种问题异常的解决方案,但是上传要写的太多了,懒呀,这里只写了个下载的例子及说明(以后有时间了再写上传视频的)。
先罗列一下上传及下载的常见问题吧:
上传:
...
if(typeof String.prototype.trim !== 'function')
{
String.prototype.trim = function()
{
return this.replace(/^\s+|\s+$/g, '');
}
}
//验证名称由数字,字母,汉字,下划线,横线,空格组成。
var patrn=/^[\w\u4e00-\u9fa5\s-]+$/;
<%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*" %>
<%!
Color getRandColor(int fc,int bc){//给定范围获得随机颜色
Random random = new Random();
if(fc>255) fc=255;
if(bc>255) bc=255;
int r=fc+random.nex ...
META-INF中加入配置文件
context.xml
引用
<?xml version="1.0" encoding="UTF-8"?>
<Context reloadable="true" crossContext="true">
<ResourceLink name="jdbc/mysql" global="jdbc/dbcp/mysql/项目" type="java.sql.DataSource">
& ...
Criteria分页查询消除重复行
- 博客分类:
- hibernate
业务要求:查询出所有除角色为管理员以外的所有用户
public Pagination findUserList(final Pagination pagination , final String param)
{
final List result = this.getHibernateTemplate().executeFind(
new HibernateCallback() {
public Object doInHibernate(final Session session)
throws HibernateExcept ...