- 浏览: 37837 次
- 性别:
- 来自: 重庆
最新评论
文章列表
//-------------------------------可以将图片等比例缩小
//========还学到了获得图片的宽,高
BufferedImage im = ImageIO.read(new File("E:\\Vista.jpg"));
width = im.getWidth();
height =im.getHeight();
//===============================
package com.Utils;
import java.awt.image.BufferedImage;
import java.i ...
网页中一些特殊字符的转换,如[image]
- 博客分类:
- utils
package com.email.util;
public class BBCODE {
//
// [img code="1.jpg"][img code="2.jpg"]
// <img src="1.jpg" /><img src="2.jpg" />
public static String filter(String code){
//加粗...
code = code.replaceAll("(\ ...
BigDecimal 的学习
- 博客分类:
- utils
package com.util;
import java.math.BigDecimal;
/**
*
*
BigDecimal(String)是把一个以String表示的BigDecimal对象构造为BigDecimal对象实例。
习惯上,对于浮点数我们都会定义为double或float,但BigDecimal API文档中对于BigDecimal(double)有这么一段话:
Note: the results of this constructor can be somewhat unpredictable. One might assume that new BigDec ...
package com.util;
public class RMB {
private final static String[] CN_Digits = { "零", "壹", "貳", "叁", "肆", "伍",
"陆", "柒", "捌", "玖", };
/**
* 将数字型货币转换为中文型货币 <br/> 作者:wallimn 时间:2009-4-10 ...
每次访问jsp页面都出现下面异常;
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 23 in the generated java file
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
//所有jsp都不能编译,不能显示;;;
//包冲突
//jsp 工作 servlet-api.jar jsp-api.jar [ ...
单例模式的七种写法
文章分类:Java编程
转载请注明出处:http://cantellow.iteye.com/blog/838473
第一种(懒汉,线程不安全):
Java代码
1. public class Singleton {
2. private static Singleton instance;
3.
4. public static Singleton getInstance() {
5. if (instance == null) {
6. instance = ...
package com.email.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipFile;
impor ...
package com.email.util;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public final class CookiesUtils {
public stat ...
import javax.servlet.http.HttpServletRequest;
public final class ParameterUtils {
public static boolean isNumber(String key){
if(key != null && key.length() > 0){
return key.matches("^[0-9]+$");
}else{
return false;
}
}
/**
*
* @param request
* @param k ...
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public final class DateUtils {
public static Date strToDateYYYYMMDD(String str){
if(str == null)return null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
return sdf. ...
package com.Utils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.Has ...
package com.Utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.ut ...
package cn.java;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Address;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import ja ...
package cn.java;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public final class DateUtils {
public static Date strToDateYYYYMMDD(String str){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
return sdf.parse(str);
...
$.ajax({
type:"GET",
url:encodeURI(encodeURI("AJAXXmlServer")),
data:encodeURI(encodeURI("username="+username)),
dataType:"xml" ,
success:callback
});
1,页面端在传地址的时候用两次 encodeURI(encodeURI("username="+us ...