<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>流泪IceCream</title>
    <description>ヽ∠                        
 ヽㄊノ とス  ゝ╱ヽ  ヽレ    ノこ  ヽ/     │ノ 
   ㄖ   ごエ  ン ㄗ   ンめ' ヌ│キ   /ろ  フ│ゝ 
</description>
    <link>http://java-sky-dynasty.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
      <item>
        <title>EL表达式不被识别</title>
        <author>Java_Sky_Dynasty</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://java-sky-dynasty.javaeye.com">Java_Sky_Dynasty</a>&nbsp;
          链接：<a href="http://java-sky-dynasty.javaeye.com/blog/193195" style="color:red;">http://java-sky-dynasty.javaeye.com/blog/193195</a>&nbsp;
          发表时间: 2008年05月15日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <ul><li>1.EL表达式的一个小问题:</li>在以前使用EL表达式的时候,在JSP页面直接使用就可以了,但昨天我在做项目的时候在JSP页面上的EL表达式不能被识别.如${loginForm.username}在页面上还是显示${loginForm.username},后来我在JSP头上加上&lt;%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030" <span style="color: red">isELIgnored="false"</span>%>红色这段代码,就可以识别了.后来我研究了一下,可能是MyEclipse版本的问题.在MyEclipse6.0后,isELIgnored可能默认值是true 吧!也不是很确切.仅供参考!<br /></ul>
          <br/>
          <span style="color:red;">
            <a href="http://java-sky-dynasty.javaeye.com/blog/193195#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 15 May 2008 10:37:35 +0800</pubDate>
        <link>http://java-sky-dynasty.javaeye.com/blog/193195</link>
        <guid>http://java-sky-dynasty.javaeye.com/blog/193195</guid>
      </item>
      <item>
        <title>正则表达式的验证</title>
        <author>Java_Sky_Dynasty</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://java-sky-dynasty.javaeye.com">Java_Sky_Dynasty</a>&nbsp;
          链接：<a href="http://java-sky-dynasty.javaeye.com/blog/193155" style="color:red;">http://java-sky-dynasty.javaeye.com/blog/193155</a>&nbsp;
          发表时间: 2008年05月15日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <pre name="code" class="java">正则表达式验证:

验证 Email: String filter=/^([a-z]|[A-Za-z0-9]|[-]|[_][.])([A-Za-z0-9])+@([A-Za-z0-9]|[-])+\..+$/ ; 

匹配空白行的正则表达式：\n\s*\r

评注：可以用来删除空白行

匹配HTML标记的正则表达式：&lt;(\S*?)[^>]*>.*?&lt;/\1>|&lt;.*? />

评注：网上流传的版本太糟糕，上面这个也仅仅能匹配部分，

对于复杂的嵌套标记依旧无能为力匹配首尾空白字符的正则表达式：^\s*|\s*$

评注：可以用来删除行首行尾的空白字符(包括空格、制表符、换页符等等)，

非常有用的表达式匹配Email地址的正则表达式：\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

评注：表单验证时很实用

匹配网址URL的正则表达式：[a-zA-z]+://[^\s]*

评注：网上流传的版本功能很有限，上面这个基本可以满足需求

匹配帐号是否合法(字母开头，允许5-16字节，允许字母数字下划线)：^[a-zA-Z][a-zA-Z0-9_]{4,15}$

评注：表单验证时很实用

匹配国内电话号码：\d{3}-\d{8}|\d{4}-\d{7}

评注：匹配形式如 0511-4405222 或 021-87888822 

匹配腾讯QQ号：[1-9][0-9]{4,}

评注：腾讯QQ号从10000开始

匹配中国邮政编码：[1-9]\d{5}(?!\d)

评注：中国邮政编码为6位数字

匹配身份证：\d{15}|\d{18}

评注：中国的身份证为15位或18位

</pre>
          <br/>
          <span style="color:red;">
            <a href="http://java-sky-dynasty.javaeye.com/blog/193155#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 15 May 2008 08:54:20 +0800</pubDate>
        <link>http://java-sky-dynasty.javaeye.com/blog/193155</link>
        <guid>http://java-sky-dynasty.javaeye.com/blog/193155</guid>
      </item>
      <item>
        <title>Java_CreateCSVFile</title>
        <author>Java_Sky_Dynasty</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://java-sky-dynasty.javaeye.com">Java_Sky_Dynasty</a>&nbsp;
          链接：<a href="http://java-sky-dynasty.javaeye.com/blog/192819" style="color:red;">http://java-sky-dynasty.javaeye.com/blog/192819</a>&nbsp;
          发表时间: 2008年05月14日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          1.Create CSV File Code:<br /><pre name="code" class="java">package com.ufinity.mealsordering.common.util;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import com.ufinity.mealsordering.common.Config;
import com.ufinity.mealsordering.common.Constant;
import com.ufinity.mealsordering.dao.impl.BaseDAO;

public class CreateCSVFile extends BaseDAO{

	private static CreateCSVFile _createCSVFile = null;
	private FileOutputStream _fos = null;
	private StringBuffer _sBuffer = null;
	private String _path = "";
	
	public static final String DEL_CHAR = ",";
	public static final String AV_CHAR = "\"";
	
	public CreateCSVFile() {
		_path = Config.getString("csv_file_path");
		this.init(_path);
	}
	
	/**
	 * 
	 * @param path create csv file's path
	 */
	public void init(String path) {
		String method = "createCSVFile_init";
		
		if(path == null || path.trim().equals("")) {
			_path = Constant.DEFAULT_PATH;
		} else {
			_path = path;
		}
		try {
			_fos = new FileOutputStream(_path,false);
			_sBuffer = new StringBuffer();
			debug("", method, "create csv file sccuessful");
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			debug("", method, "not found exception of create csv file");
		}
	}
	
	/**
	 * this method is append date in csv file
	 * @param data 
	 */
	public void setData(Object data) {
        _sBuffer.append(AV_CHAR);
        _sBuffer.append(data);
        _sBuffer.append(AV_CHAR);
        _sBuffer.append(DEL_CHAR);
    }
	
	public void writeLine() {
        if (_sBuffer.charAt(_sBuffer.length() - 1) == ',')
        	_sBuffer.delete(_sBuffer.length() - 1, _sBuffer.length());
        _sBuffer.append("\r\n");
    }
	
	/**
	 * this method is close fileoutputstream
	 */
	public void close() {
		String method = "close";
        try {
            if(_sBuffer != null) {
            	_fos.write(_sBuffer.toString().getBytes());
                debug("", method, "close fileOutputStream successful");
            } else {
            	debug("", method, "null point exception");
            }
        } catch (IOException e) {
            debug("", method, "close fileOutputStream failure");
        } finally {
            try {
				if(_fos != null) {
					_fos.close();
					_fos = null;
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
        }
    }
}
</pre><br /><br />2.Create CSV File Action:<br /><pre name="code" class="java">/**
	 * updateExpired method is update order_history table's attribute(is
	 * expired) Expired that the &lt;True> value is 0, 1 said that &lt;False>
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @author wuwenqiang
	 */
	public ActionForward updateExpired(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		String method = "updateExpired";
		String createFileMethod = "createFile";
		String userId = (String) request.getSession().getAttribute("Portal");
		ActionMapping _mapping = null;
		
		List allOrderHistoryList = new LinkedList();
		List _orderHistoryList = new LinkedList();
		
		try {

			DateManager.getInstance().compareTime(_am.queryALlGlobalSettings());
			long startTime = DateManager.getInstance().get_timeMillisStart();
			long endTime = DateManager.getInstance().get_timeMillisEnd();

			allOrderHistoryList = _am.queryOrderHistoryAll(startTime, endTime);
			if (allOrderHistoryList == null || allOrderHistoryList.size() &lt;= 0) {
				this.debug(userId, createFileMethod,
						Constant.MESSAGE_QUERY_NOELEMENT);
			} else {
				 _orderHistoryList = _ohOperation
						.addOrderHistory(allOrderHistoryList);
				CreateCSVFile createCSVFile = new CreateCSVFile();
				createCSVFile.setData(Constant.RESTAURANT_NAME);
				createCSVFile.setData(Constant.MEAL_NAME);
				createCSVFile.setData(Constant.MEAL_PRICE);
				createCSVFile.setData(Constant.NUM);
				createCSVFile.setData(Constant.SUBSCRIBER_NAME);
				createCSVFile.setData(Constant.ORDER_TIME);
				createCSVFile.writeLine();
				for (int i = 0; i &lt; allOrderHistoryList.size(); i++) {
					OrderHistory orderHistory = (OrderHistory) allOrderHistoryList
							.get(i);
					createCSVFile.setData(orderHistory.getMeal()
							.getRestaurant().getRestName());
					createCSVFile.setData(orderHistory.getMeal().getMealName());
					createCSVFile.setData(orderHistory.getMeal()
							.getSinglePrice());
					createCSVFile.setData(orderHistory.getNum());
					createCSVFile.setData(orderHistory.getEmployee()
							.getFullName());
					createCSVFile.setData(orderHistory.getTime());
					createCSVFile.writeLine();
				}
				createCSVFile.close();
			}		_am.updateExpired(startTime, endTime);
			
			request.getSession().setAttribute("addOrderHistory_list",_orderHistoryList);
			request.setAttribute("flag", "flag_true");
			this.debug(userId, method, Constant.LOG_UPDATE_SUCCESS);
			return mapping.findForward("list_update");

		} catch (ManagerException e) {
			e.printStackTrace();
			this.error(userId, method, "hibernate exception", e);
		}

		this.debug(userId, method, Constant.LOG_UPDATE_FAIL);
		request.setAttribute("flag", "flag_false");

		return mapping.findForward("return_error");
	}
</pre><br /><br /><br />3.DownLoad CSV File Action:<br /><pre name="code" class="java">/**
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws UnsupportedEncodingException
	 */
	public ActionForward downloadCSVFile(ActionMapping mapping,
			ActionForm form, HttpServletRequest request,
			HttpServletResponse response) {
		String method = "downloadCSVFile";
		String userId = (String) request.getSession().getAttribute("Portal");

		PrintWriter pw = null;
		response.setContentType("application/octet-stream;charset=GBK");
		response.setHeader("Content-Disposition",
				"attachment; filename=\"mealordering.csv\"");
		List allOrderHistoryList = new LinkedList();

		String strHead = Constant.RESTAURANT_NAME + "," + Constant.MEAL_NAME
				+ "," + Constant.MEAL_PRICE + "," + Constant.NUM + ","
				+ Constant.SUBSCRIBER_NAME + "," + Constant.ORDER_TIME;

		try {
			pw = response.getWriter();
			pw.println(strHead);
			
			allOrderHistoryList = (List)request.getSession().getAttribute("addOrderHistory_list");

			if (allOrderHistoryList == null || allOrderHistoryList.size() &lt;= 0) {

				this.debug("'", method, Constant.MESSAGE_QUERY_NOELEMENT);

			} else {
		
				for (Iterator iterator = allOrderHistoryList.iterator(); iterator
						.hasNext();) {
					OrderHistory orderHistory = (OrderHistory) iterator.next();
					String restName = String.valueOf(orderHistory.getMeal()
							.getRestaurant().getRestName());
					String mealName = String.valueOf(orderHistory.getMeal()
							.getMealName());
					String mealPrice = String.valueOf(orderHistory.getMeal()
							.getSinglePrice());
					String num = String.valueOf(orderHistory.getNum());
					String subscriber = String.valueOf(orderHistory
							.getEmployee().getFullName());
					String orderTime = String.valueOf(orderHistory.getTime());

					String strLine = "\"" + restName + "\",\"" + mealName
							+ "\",\"" + mealPrice + "\",\"" + num + "\",\""
							+ subscriber + "\",\"" + orderTime + "\"";

					pw.println(strLine);
				}
				pw.flush();
				pw.close();
			}
		} catch (IOException e) {
			e.printStackTrace();
			this.debug(userId, method, "IOException");
		}	
		return null;
	}</pre>
          <br/>
          <span style="color:red;">
            <a href="http://java-sky-dynasty.javaeye.com/blog/192819#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 14 May 2008 09:16:28 +0800</pubDate>
        <link>http://java-sky-dynasty.javaeye.com/blog/192819</link>
        <guid>http://java-sky-dynasty.javaeye.com/blog/192819</guid>
      </item>
      <item>
        <title>Hibernate_ExportDB</title>
        <author>Java_Sky_Dynasty</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://java-sky-dynasty.javaeye.com">Java_Sky_Dynasty</a>&nbsp;
          链接：<a href="http://java-sky-dynasty.javaeye.com/blog/192813" style="color:red;">http://java-sky-dynasty.javaeye.com/blog/192813</a>&nbsp;
          发表时间: 2008年05月14日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Auto Create Table Code:<br /><br /><pre name="code" class="java">package com.ufinity.hibernate.util;

import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * 
 * @author skyqiang
 *
 */
public class ExportDB {
	public static void main(String[] args) {
		
		//read configuration file
		Configuration config = new Configuration();
		
		//create SchemaExport object
		SchemaExport export = new SchemaExport(config);
		
		//create table of database
		export.create(true, true);
		
	}
	
}
</pre>
          <br/>
          <span style="color:red;">
            <a href="http://java-sky-dynasty.javaeye.com/blog/192813#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 14 May 2008 09:07:26 +0800</pubDate>
        <link>http://java-sky-dynasty.javaeye.com/blog/192813</link>
        <guid>http://java-sky-dynasty.javaeye.com/blog/192813</guid>
      </item>
      <item>
        <title>Spring_DynamicProxy</title>
        <author>Java_Sky_Dynasty</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://java-sky-dynasty.javaeye.com">Java_Sky_Dynasty</a>&nbsp;
          链接：<a href="http://java-sky-dynasty.javaeye.com/blog/192704" style="color:red;">http://java-sky-dynasty.javaeye.com/blog/192704</a>&nbsp;
          发表时间: 2008年05月13日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Dynamic Proxy of Spring:<br /><pre name="code" class="java">package com.ufinity.spring;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class SecurityHandler implements InvocationHandler{

	private Object targetObj;
	
	
	public Object newProxy(Object targetObj) {
		this.targetObj = targetObj;
		return Proxy.newProxyInstance(targetObj.getClass().getClassLoader() ,
				 					  targetObj.getClass().getInterfaces() ,
				 					  this);
	}
	
	//实现了IncocationHandler接口,里面的一个方法.
	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		this.checkSecurity();
		Object result = null;
		result = method.invoke(this.targetObj, args);
		return result;
	}	
	
        //check security method
	private void checkSecurity() {
		System.out.println("-----------------SecurityHandler.checkSecurity()--------------");
	}
}
</pre>
          <br/>
          <span style="color:red;">
            <a href="http://java-sky-dynasty.javaeye.com/blog/192704#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Tue, 13 May 2008 19:19:46 +0800</pubDate>
        <link>http://java-sky-dynasty.javaeye.com/blog/192704</link>
        <guid>http://java-sky-dynasty.javaeye.com/blog/192704</guid>
      </item>
  </channel>
</rss>