当幸福来敲门

我就会牢牢抓住!
随笔 - 50, 文章 - 3, 评论 - 8, 引用 - 0
数据加载中……

2012年6月14日

需求工程师的工作内容

1.和业务部门 、客户沟通(沟通是整个需求设计到开发使用为止);
2.学习业务;
3.有意识听速求(客户最急需的),也就是优先级问题;
4.搜集需求,整合,提炼,完成分析;(考虑周全找关联 找核心)
5.编写需求产品文档(文字和图列、流程图等相结合)
6.掌握相关工具;(比如visio/axure)
7.文档系统讲解(讲解对象:开发和测试)
8.验证开发完后的产品(验证结束后再测试);
9.用户培训(需求工程师主持);
10.了解相关系统(了解整个业务面 而不是 内部的功能点);

注意:数据表设计中尽量存可分析的信息代码;

posted @ 2014-03-05 15:23 wyx 阅读(184) | 评论 (0)编辑 收藏

面试题积累

  1. struts1和struts2的区别
  2. hibernate和ibatis的区别
  3. json和xml的区别
  4. ajax的原理
  5. ajax和iframe嵌套有什么区别
  6. gbk utf8 iso-8859-1都是多少字节
  7. extjs和jquery的区别
  8. js从前端如何解决跨域问题
  9. 单例模式的优点,工厂模式的原理
  10. spring的mvc模式
  11. jdk1.7新功能
  12. 为什么会出现乱码

posted @ 2014-03-04 15:35 wyx 阅读(215) | 评论 (0)编辑 收藏

Hibernate 查询有关in的查询

http://www.iteye.com/problems/74892

List<Integer> ids = new ArrayList<Integer>();
ids.add(3);
ids.add(4);
ids.add(5);
Query query=session.createQuery(from document where id in (:ids)); 
query.setParameterList("ids", ids);
query.list();

posted @ 2013-11-18 17:42 wyx 阅读(609) | 评论 (0)编辑 收藏

用hibernate插入数据保证插入数据ID同步 ,插入之后返回对象

public FDataReport addFDataReport(FDataReport datareport);//数据新录入返回对象,对应的就会把ID也返回

posted @ 2013-11-04 17:43 wyx 阅读(244) | 评论 (0)编辑 收藏

关于登录界面 记住用户名和密码的一段代码

Cookie cookies[]=request.getCookies();
    Cookie stCookie=null;
    String password=null;
    String passwordvalue=null;
    String usernamevalue=null;
    String cookiename = null;
    String nameandpassword[]=new String[3];
    if (cookies != null) {
   for (int i = 0; i < cookies.length; i++) {
    stCookie = cookies[i];
    cookiename = stCookie.getName();
    if (cookiename!=null && cookiename.equalsIgnoreCase("db_password")) {
     passwordvalue = stCookie.getValue();
     password = passwordvalue;//.substring(8, passwordvalue.length()-3);
     nameandpassword[1] = password.trim();
    }
    if (cookiename!=null && cookiename.equalsIgnoreCase("db_username")) {
     usernamevalue = stCookie.getValue();
     nameandpassword[0] = usernamevalue.trim();
    }
    }
 }





<body>
<p>
       <label for="LoginName">
        用户名 / 邮箱:
       </label>
       <input class="text" type="text" id="LoginName" name="LoginName"
        value="<%=nameandpassword[0]==null?"":nameandpassword[0] %>" />
      </p>
      <p>
       <label for="Password">
        密码:
       </label>
       <input class="text" type="password" value="<%=nameandpassword[1]==null?"":nameandpassword[1] %>" name="Password" id="Password" />
      </p>


</body>

posted @ 2013-11-01 15:08 wyx 阅读(299) | 评论 (0)编辑 收藏

form表单提交两次原因

昨天做用户注册,添加用户时候总是提交两次
最后才找到原因 提交表单的按钮就是设置成button的了 但是名称是submitButton也不可以 所以修改下按钮名称就可以了!!!
⊙﹏⊙b汗

posted @ 2013-10-18 09:21 wyx 阅读(415) | 评论 (0)编辑 收藏

关于安全问题——用户中心

1.当用户操作用户中心的信息,编码获取用户对象应该是通过该用户登录保存的session或者cookie获得,
而不是通过用户ID获得(否则当有人知道通过ID传值,容易轻易修改掉其他用户的信息)

2.前台下载也需要通过后台处理 放置业内人士知道下载文件真实地址,获得大量数据信息

posted @ 2013-09-04 17:13 wyx 阅读(194) | 评论 (0)编辑 收藏

FCKeditor 取值

《转自http://blog.sina.com.cn/s/blog_5f66526e0100kf6b.html

主要步骤:

第一步:导入需要的js文件(根据实际情况修改相应路径)
<script src="js/jquery.js" type=text/javascript></script>   
<script src="fckeditor/fckeditor.js" type="text/javascript"></script>
第二步:初始化(根据实际情况修改相应路径)   

sBasePath    = '/duotunkf/fckeditor/' ;#编辑器所在文件夹;
oFCKeditor    = new FCKeditor('content') ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Value = 'test' ;
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.Create() ;

其中content为页面你所绑定的textArea的id或name

第三步:取值

var oEditor = FCKeditorAPI.GetInstance('content');  
editorValue = oEditor.GetHTML();  
第四步:赋值(更新的时候先把原有的值赋给textarea)

var oEditor = FCKeditorAPI.GetInstance('content');  
oEditor.SetHTML("value"); 

 

下面是本人写的一个赋值测试程序,供大家参考。源码如下:

<html>
 <head>

     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="js/jquery-1.3.2.min.js"></script>
        <script src="fckeditor/fckeditor.js"></script>
        <script>
        $(document).ready(function(){
          $("#test").click(function(){
    var oEditor = FCKeditorAPI.GetInstance('content');  
    oEditor.SetHTML($("#test option:selected" ).text());
    });
  });
        </script>
 </head>
 <body>
  
  <form action="" method="post">
        <script>
            sBasePath    = '/duotunkf/fckeditor/' ;#编辑器所在文件夹;
            oFCKeditor   = new FCKeditor('content') ;
            oFCKeditor.BasePath = sBasePath ;
            oFCKeditor.Value = 'test' ;
            oFCKeditor.ToolbarSet = 'Basic' ;
            oFCKeditor.Create() ;
  </script>
   <br>
            <label for="test">
      <select name="test" size="4" id="test">
        <option value="1">i.点击这里改变编辑器的值</option>
        <option value="2">ii.点击这里改变编辑器的值</option>
        <option value="3">iii.点击这里改变编辑器的值</option>
           </select>
          </label>
  </form>
 </body>
</html>


posted @ 2013-07-31 14:19 wyx 阅读(170) | 评论 (0)编辑 收藏

关于数据表建设的int 和 number varchar和nvarchar的区别


提交了,刚才修正了一些问题;一主键需要设置number类型同时告诉扩充到10
管华(管华) 10:44:15
你刚才是int类型,,int最大是到6万多吧,,如果你设置这个,意味着到时你到6万多的会员后,系统出问题,插入不进去了,到时你还得改;
管华(管华) 10:45:46
第二,你用的是字符VARCHAR2类型,这个;类型在oracle里不太好,会持久化占用一部分空间,比如你设置的VARCHAR2(1000),他不管你里面有没有数据,都会占用这1000个字符的空间;因此需要改为NVARCHAR2 ,他是自适应,当你没存储值,他不占据空间


另外根据有些字段,比如人名  name  NVARCHAR2(20)分配20个字符就可了,分配500个,会浪费多余的空间同时使得系统慢碎片多;因此根据实际情况,酌情分配

posted @ 2013-07-12 10:49 wyx 阅读(317) | 评论 (0)编辑 收藏

sql语句特殊字符处理

update tc_report t set xlsfile='ChinaLivestock'||chr(38)||'FeedWeeklyMarketReport20130703.doc' where t.xlsfile like 'China Livestock & Feed Weekly Market Report 20130703%'

posted @ 2013-07-04 10:36 wyx 阅读(262) | 评论 (0)编辑 收藏

Tomcat修改文件重启问题

将tomcat下的bin\startup.bat下的文件打开后,最下面有一句话  call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%,,复制我这个替换你那个,保存后,即可实现不重启就编译java

posted @ 2013-07-01 11:32 wyx 阅读(171) | 评论 (0)编辑 收藏

JavaBean中打印信息到JSP页面

http://blog.csdn.net/sclxf/article/details/4654080

posted @ 2013-05-16 17:47 wyx 阅读(154) | 评论 (0)编辑 收藏

JS 获得系统当前时间和未来一周时间

例子:

function getDate(day){
   var zdate=new Date();
   var sdate=zdate.getTime()-(1*24*60*60*1000);
   var edate=new Date(sdate-(day*24*60*60*1000)).format("yyyy-MM-dd");
   return edate;
}

 function changevalue(obj){
       alert(obj);
       var a = getDate(+7);
       var b = getDate(+31);
       if(obj=="8"){
       document.getElementById("enddate").value=b;
       }else{
       document.getElementById("enddate").value=a;
       }
 }

posted @ 2013-05-08 15:54 wyx 阅读(374) | 评论 (0)编辑 收藏

转换PDF遇到的问题java.lang.UnsatisfiedLinkError: no jcom in java.library.path

java.lang.UnsatisfiedLinkError: no jcom in java.library.path
将 jcom.dll 文件放在  C:\WINDOWS\system32 和jdk的bin   目录下

posted @ 2013-04-10 16:14 wyx 阅读(416) | 评论 (0)编辑 收藏

BUG 调试 加入断点但是跳转时候没有走

设置问题  Debug model选中

posted @ 2013-04-03 15:34 wyx 阅读(194) | 评论 (0)编辑 收藏

投研项目 文档 总结

1.下载模块:年鉴、研究报告、企业榜单和行业数据(需要权限控制)
2.FTP使用:

posted @ 2013-03-27 11:09 wyx 阅读(248) | 评论 (0)编辑 收藏

2013-03-13 项目开发 总结 连载记录

1.针对不同类型跳转不同的action方法 除了使用JS以外  还可以 使用参数获得参数例如method=....不同值来跳转像不同的方法
例子:分国别 (method="showCountryList")  分地区(method="showAreaList")  
        后台 String method = request.getParameter("method");
             request.setAttribute("method", method);
    if (method != null && method.equals("showCountryList")) {
     return showCountryList(map, form, request, response);//分国别
   } else if (method != null && method.equals("showAreaList")) {
     return showAreaList(map, form, request, response);//分地区
   }
2.Jsp........记得使用IFram嵌套
<iframe width="100%" height="800" class="share_self"  frameborder="0" scrolling="no" src="/tyreportAction.do?method=lookReportInfo&bid=${record.bid } "></iframe>
 总结:思维要活跃些  往往一个问题有很多种解决方法的

posted @ 2013-03-13 09:38 wyx 阅读(168) | 评论 (0)编辑 收藏

大文本值CLOB取值 和 存值

存值
 Clob  organdetail =Hibernate.createClob(request.getParameter("organdetail").equals("")?"":request.getParameter("organdetail").trim());// 机构简介
   取值 显示JSP
<%=ToolsCommon.Clob2String(institutions.getOrgandetail())==null?"":ToolsCommon.Clob2String(institutions.getOrgandetail())%>


 public static String Clob2String(java.sql.Clob clob) {
  String s1 = "";
  char ac[] = new char[200];

  if (clob == null)
   return null;
  java.io.Reader reader = null;
  int i;
  try {
   reader = clob.getCharacterStream();
   while ((i = reader.read(ac, 0, 200)) != -1)
    s1 = s1 + new String(ac, 0, i);
  } catch (Exception exception1) {
   // throw new java.sql.SQLException(exception1.getMessage());
   System.out.println(exception1.toString());
  }

  finally {
   try {
    reader.close();
   } catch (Exception _ex) {
   }
  }
  return s1;

 }

posted @ 2013-02-28 10:20 wyx 阅读(356) | 评论 (0)编辑 收藏

Java 删除文件夹 和 文件 集合

《此文拷贝自http://kxjhlele.iteye.com/blog/323657

1,验证传入路径是否为正确的路径名(Windows系统,其他系统未使用)


// 验证字符串是否为正确路径名的正则表达式
private static String matches = "[A-Za-z]:\\\\[^:?\"><*]*";
// 通过 sPath.matches(matches) 方法的返回值判断是否正确
// sPath 为路径字符串

2,通用的文件夹或文件删除方法,直接调用此方法,即可实现删除文件夹或文件,包括文件夹下的所有文件


    /**
     *  根据路径删除指定的目录或文件,无论存在与否
     *@param sPath  要删除的目录或文件
     *@return 删除成功返回 true,否则返回 false。
     */
    public boolean DeleteFolder(String sPath) {
        flag = false;
        file = new File(sPath);
        // 判断目录或文件是否存在
        if (!file.exists()) {  // 不存在返回 false
            return flag;
        } else {
            // 判断是否为文件
            if (file.isFile()) {  // 为文件时调用删除文件方法
                return deleteFile(sPath);
            } else {  // 为目录时调用删除目录方法
                return deleteDirectory(sPath);
            }
        }
    }

3,实现删除文件的方法,

    /**
     * 删除单个文件
     * @param   sPath    被删除文件的文件名
     * @return 单个文件删除成功返回true,否则返回false
     */
    public boolean deleteFile(String sPath) {
        flag = false;
        file = new File(sPath);
        // 路径为文件且不为空则进行删除
        if (file.isFile() && file.exists()) {
            file.delete();
            flag = true;
        }
        return flag;
    }

4,实现删除文件夹的方法,

    /**
     * 删除目录(文件夹)以及目录下的文件
     * @param   sPath 被删除目录的文件路径
     * @return  目录删除成功返回true,否则返回false
     */
    public boolean deleteDirectory(String sPath) {
        //如果sPath不以文件分隔符结尾,自动添加文件分隔符
        if (!sPath.endsWith(File.separator)) {
            sPath = sPath + File.separator;
        }
        File dirFile = new File(sPath);
        //如果dir对应的文件不存在,或者不是一个目录,则退出
        if (!dirFile.exists() || !dirFile.isDirectory()) {
            return false;
        }
        flag = true;
        //删除文件夹下的所有文件(包括子目录)
        File[] files = dirFile.listFiles();
        for (int i = 0; i < files.length; i++) {
            //删除子文件
            if (files[i].isFile()) {
                flag = deleteFile(files[i].getAbsolutePath());
                if (!flag) break;
            } //删除子目录
            else {
                flag = deleteDirectory(files[i].getAbsolutePath());
                if (!flag) break;
            }
        }
        if (!flag) return false;
        //删除当前目录
        if (dirFile.delete()) {
            return true;
        } else {
            return false;
        }
    }

5,main() 方法


    public static void main(String[] args) {

        HandleFileClass hfc = new HandleFileClass();
        String path = "D:\\Abc\\123\\Ab1";
        boolean result = hfc.CreateFolder(path);
        System.out.println(result);
        path = "D:\\Abc\\124";
        result = hfc.DeleteFolder(path);
        System.out.println(result);

    }


main() 方法只是做了一个简单的测试,建立文件夹和文件都是本地建立,情况考虑的应该很全面了,包括文件夹包含文件夹、文件。文件的不同情况…………

 

实现没有问题,可以正确删除文件夹和文件。

 

对于其他类型文件的操作继续学习…………




posted @ 2013-01-18 15:58 wyx 阅读(295) | 评论 (0)编辑 收藏

JFreechar

http://www.blogjava.net/amigoxie/archive/2007/09/30/149765.html

posted @ 2012-12-26 15:51 wyx 阅读(182) | 评论 (0)编辑 收藏

orcle修改属性字段 并且保留原有值

1.原字段类型是字符串 使用“||”连接
update table1 set num = substr(num,0,instr(num,'-'))||(substr(num,instr(num,'-')+1) +9) 
2.原字段是数字 使用+连接
UPDATE table1SET num = num+10 
3.截取 update tc_report t set xlsfile=substr(xlsfile,6) where xlsfile like '%uku\%'

posted @ 2012-11-12 10:20 wyx 阅读(318) | 评论 (0)编辑 收藏

form表单 修改 多选框默认选中

1.放到HashMap中
  String varsort=exp.getVarsort();
   String vars[]=null;
   HashSet setvar = new HashSet();
   if(varsort!=null&&!varsort.trim().equals("")){
    vars=varsort.substring(0,varsort.length()-1).split(",");
    for(int i=0;i<vars.length;i++){
     setvar.add(vars[i].trim());
    }
   }
2. contains比较是否包含
<% if(varsorts!=null&&varsorts.size()>0){
           for(int j=0;j<varsorts.size();j++){
            TDictionarys td=varsorts.get(j);
            %>
         <input type="checkbox" value="<%=td.getDataid() %>" <%if(setvar.contains(String.valueOf(td.getDataid()).trim())){out.print("checked");} %> onclick="getBreeds()" name="varsort" id="varsort" />
         <label for="checkbox" class="font12">
         <%=td.getName() %>
            </label>
            <%
           }
          }
         %>
        

posted @ 2012-09-21 18:03 wyx 阅读(1317) | 评论 (1)编辑 收藏

页面级缓存处理

前提  列表走了数据库查询
1.引入架包  <%@ taglib uri="oscache" prefix="cache"%>
2.包含要缓存的部分
<cache:cache key="dbnewscache" time="3600">  
        <%List<Article> list=new CmsByMysql().getNews(); %>
          <c:forEach var="cu" items="<%=list%>">
               <li>
          <a href="${cu.url}">${cu.titleContent} </a>
            </li>
          </c:forEach>
</cache:cache>

posted @ 2012-09-21 17:25 wyx 阅读(223) | 评论 (0)编辑 收藏

Ifram 父子页面 JS调用

<iframe marginwidth="0" framespacing="0" marginheight="0" frameborder="0"
name="uploadframe" id="uploadframe" src="c.html" scrolling="no" width="100" height="100" ></iframe>
如想在c.html 中写一些代码去改变parent.html 中的一些内容,以下代码可作为参考:

1、parent.window.frames 可返回parent.html 中所有的iframe;返回结果应该是一个数组,用parent.window.frames[iframeId]可得到iframeId;

2、用parent.document.getElementById('xxxx')可得到父里的xxxx,并改变相应的值,例如:parent.document.getElementById('xxxx').className = 'test';

3、如果我想在父中再创建一个元素,直接用parent.appendChild(yyyy)在firefox中是可以的,但在IE(最起码IE6)是不行的; 所以,要把创建这个动作放在父中来完成,在子中调用;

 parent.document.getElementById("pinming").innerHTML = retText2;

posted @ 2012-07-24 15:29 wyx 阅读(709) | 评论 (0)编辑 收藏

jquery目录树 js实现 目录数插件

2011-07-13 10:07

jQuery 目录树插件介绍——ligerTree

 

 

一,简介 

ligerTree的功能列表:

1,支持本地数据和服务器数据(配置data或者url)

2,支持原生html生成Tree

3,支持动态获取增加/修改/删除节点

4,支持大部分常见的事件

5,支持获取选中行等常见的接口方法

 

二,第一个例子

引入库文件

遵循LigerUI系列插件的设计原则(插件尽量单独),ligerTree是一个单独的插件,也就是说只需要引入plugins/ligerTree.js和样式css文件就可以使用(当然必须先引入jQuery),在这个例子中,我把tree用到的样式和图片分离了出来,有兴趣的朋友可以下载来看看

  

<script src="lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<link href="lib/ligerUI/skins/Aqua/css/ligerui-tree.css" rel="stylesheet" type="text/css"/>
<script src="lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>

加入HTML

  

<ul id="tree1">
<li>
<span>节点1</span>
<ul>
<li>
<span>节点1.1</span>
<ul>
<li><span>节点1.1.1</span></li>
<li><span>节点1.1.2</span></li>
</ul>
</li>
<li><span>节点1.2</span></li>
</ul>
</li>
</ul>

调用ligerTree

<table style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; min-height: inherit !important; border-collapse: collapse !important; background-position: initial initial !important; background-repeat: initial initial !important; "><td style="font-size: 1em !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0.5em !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: initial !important; border-style: initial !important; border-color: initial !important; outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: top !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; min-height: inherit !important; border-left-style: none !important; border-left-color: initial !important; color: rgb(0, 0, 0) !important; background-position: initial initial !important; background-repeat: initial initial !important; ">$("#tree1").ligerTree();

效果图

三,常用场景

场景一:不使用复选框: 

$("#tree2").ligerTree({ checkbox: false });

场景二:不使用复习框和图标: 

$("#tree3").ligerTree({ checkbox: false, parentIcon: null, childIcon: null });

效果如图:



append(parentNode, newdata)增加节点集合clear()清空collapseAll()全部节点都折叠demotion(treenode)降级为叶节点级别expandAll()全部节点都展开getChecked()获取选择的行(复选框)getData()获取树的数据源getParentTreeItem(treenode, level)获取父节点getSelected()获取选择的行hasChildren(treenode)是否包含子节点 loadData(node, url, param)加载数据remove(node)删除节点upgrade(treenode)升级为父节点级别

posted @ 2012-07-04 16:59 wyx 阅读(2082) | 评论 (1)编辑 收藏

读取 文本 文件内容 FileInputStream 乱码处理

  StringBuffer content = new StringBuffer();
//  FileInputStream fis = null;
//  byte[] b = new byte[2048];
//  try {
//    if(lang!=null&&lang.trim().equals("10")){
//     fis = new FileInputStream(passwordTemplatePath);
//     }else if(lang!=null&&lang.trim().equals("20")){
//      fis = new FileInputStream(passwordTemplateEnPath);
//     }else if(lang!=null&&lang.trim().equals("30")){
//      fis = new FileInputStream(passwordTemplateChinaEnPath);
//     }
//     int m = 0;
//   while ((m = fis.read(b)) != -1) {
//    content.append(new String(b, 0, m));
//   }
//passwordTemplatePath 文本 文件地址
  BufferedReader br = null;
  try {
    if(lang!=null&&lang.trim().equals("10")){
         br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplatePath), "utf-8"));
      }else if(lang!=null&&lang.trim().equals("20")){
       br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplateEnPath), "utf-8"));
     }else if(lang!=null&&lang.trim().equals("30")){
        br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplateChinaEnPath), "utf-8"));
      }
    String s = null;
    while ((s = br.readLine()) != null) {
    content.append(s);
   }
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   try {
    br.close();
   } catch (IOException e) {
    e.printStackTrace();
   }
  }

posted @ 2012-06-26 17:15 wyx 阅读(2088) | 评论 (2)编辑 收藏

线程等待问题处理

class MyThread implements Runnable {
@Override
public void run() {
  System.out.println("1、进入run()方法休眠");
  try {
   System.out.println("2、线程休眠20秒");
   Thread.sleep(20000);//这里休眠20秒
   System.out.println("3、线程正常休眠完毕");
  } catch (InterruptedException e) {
   System.out.println("4、线程发生异常休眠被中断");
   return;//返回方法调用处
  }
  System.out.println("5、线程正常结束run()方法体");
}
}
public class InterruptDemo {

public static void main(String[] args) {
  MyThread mt = new MyThread();
  Thread t = new Thread(mt,"线程A");
  t.start();//启动线程
//========================================================
  try {
   Thread.sleep(2000);  //保证线程至少执行2秒
  } catch (InterruptedException e) {
   e.printStackTrace();
  }
//========================================================
  t.interrupt();//中断线程
}
}

posted @ 2012-06-21 15:21 wyx 阅读(189) | 评论 (0)编辑 收藏

"Mon Dec 28 00:00:00 CST 2008"的格式字符串转换 yyyy-MM-dd 格式

public static void main(String[] args)
 {
   try {
      java.util.Date date;
      // 首先设置"Mon Dec 28 00:00:00 CST 2008"的格式,用来将其转化为Date对象
      DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);

      //将已有的时间字符串转化为Date对象
      date = df.parse("Tue Jun 19 00:00:00 CST 2012");// 那天是周一
      // 创建所需的格式
      df = new SimpleDateFormat("yyyy-MM-dd");
      String str = df.format(date);// 获得格式化后的日期字符串
      System.err.println(str);// 打印最终结果
     } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
     }


 }

posted @ 2012-06-19 16:12 wyx 阅读(6928) | 评论 (1)编辑 收藏

JAVA开发者最常去的25个英文网站 (转载http://handawei.iteye.com/blog/675034)

  • http://www.infoq.com/ - Info IT新闻
  • http://www.apache.org/ - Apache基金会
  • http://www.springsource.org/ - 广大Java开发者喜爱的Spring
  • http://www.hibernate.org/ - 开源ORM框架
  • http://sourceforge.net/ - 开源技术的集结地
  • http://www.javaalmanac.com – Java开发者年鉴一书的在线版本. 要想快速查到某种Java技巧的用法及示例代码, 这是一个不错的去处.
  • http://www.onjava.com – O’Reilly的Java网站. 每周都有新文章.
  • http://java.sun.com – 官方的Java开发者网站 – 每周都有新文章发表.
  • http://www.developer.com/java – 由Gamelan.com 维护的Java技术文章网站.
  • http://www.java.net – Sun公司维护的一个Java社区网站.
  • http://www.builder.com – Cnet的Builder.com网站 – 所有的技术文章, 以Java为主.
  • http://www.ibm.com/developerworks/java – IBM的Developerworks技术网站; 这是其中的Java技术主页.
  • http://www.javaworld.com – 最早的一个Java站点. 每周更新Java技术文章.
  • http://www.devx.com/java – DevX维护的一个Java技术文章网站.
  • http://www.fawcette.com/javapro – JavaPro在线杂志网站.
  • http://www.sys-con.com/java – Java Developers Journal的在线杂志网站.
  • http://www.javadesktop.org – 位于Java.net的一个Java桌面技术社区网站.
  • http://www.theserverside.com – 这是一个讨论所有Java服务器端技术的网站.
  • http://www.jars.com – 提供Java评论服务. 包括各种framework和应用程序.
  • http://www.jguru.com – 一个非常棒的采用Q&A形式的Java技术资源社区.
  • http://www.javaranch.com – 一个论坛,得到Java问题答案的地方,初学者的好去处。
  • http://www.ibiblio.org/javafaq/javafaq.html – comp.lang.java的FAQ站点 – 收集了来自comp.lang.java新闻组的问题和答案的分类目录.
  • http://java.sun.com/docs/books/tutorial/ – 来自SUN公司的官方Java指南 – 对于了解几乎所有的java技术特性非常有帮助.
  • http://www.javablogs.com – 互联网上最活跃的一个Java Blog网站.
  • http://java.about.com/ – 来自About.com的Java新闻和技术文章网站.
  • posted @ 2012-06-15 15:44 wyx 阅读(198) | 评论 (0)编辑 收藏

    EL表达式处理字符串 是否 包含 某字符串 截取 拆分...............

    JSP页面页头添加
    <%@ taglib uri="/WEB-INF/taglib/c.tld" prefix="c"%>
    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>  两个标签
    页面内容如下: 

    <c:if test="${fn:contains(record.name,'样例')==false}">
                                     <%
             if ((f != null && f.trim().equals("0"))&&name!=null&&!name.trim().equals("免费报告")) {
            %><a
             href="javascript:void(0);alert('很抱歉,您无权访问!如需访问请购买产品或联系管理员...');">
             ${record.name} </a>
            <%
             } else {
            %>
            <a
             href="/tcreportAction.do?method=lookReportInfo&bid=${record.bid } ">${record.name}</a>
            <%
             }
            %>
             </c:if>
               <c:if test="${fn:contains(record.name,'样例')}">
                                       <a
             href="/tcreportAction.do?method=lookReportInfo&bid=${record.bid } ">${record.name}</a>
           
                                     </c:if>



    ${wjcd.lrsj}原来得到的是如2006-11-12 11:22:22.0

    ${fn:substring(wjcd.lrsj, 0, 16)}

    使用functions函数来获取list的长度

    ${fn:length(list)}

     

     

     

    1. fn:contains(string, substring)   
    2. 假如参数string中包含参数substring,返回true   
    3.   
    4. fn:containsIgnoreCase(string, substring)   
    5. 假如参数string中包含参数substring(忽略大小写),返回true   
    6.   
    7. fn:endsWith(string, suffix)   
    8. 假如参数 string 以参数suffix结尾,返回true   
    9.   
    10. fn:escapeXml(string)   
    11. 将有非凡意义的XML (和HTML)转换为对应的XML character entity code,并返回   
    12.   
    13. fn:indexOf(string, substring)   
    14. 返回参数substring在参数string中第一次出现的位置   
    15.   
    16. fn:join(array, separator)   
    17. 将一个给定的数组array用给定的间隔符separator串在一起,组成一个新的字符串并返回。   
    18.   
    19. fn:length(item)   
    20. 返回参数item中包含元素的数量。参数Item类型是数组、collection或者String。假如是String类型,返回值是String中的字符数。   
    21.   
    22. fn:replace(string, before, after)   
    23. 返回一个String对象。用参数after字符串替换参数string中所有出现参数before字符串的地方,并返回替换后的结果   
    24.   
    25. fn:split(string, separator)   
    26. 返回一个数组,以参数separator 为分割符分割参数string,分割后的每一部分就是数组的一个元素   
    27.   
    28. fn:startsWith(string, prefix)   
    29. 假如参数string以参数prefix开头,返回true   
    30.   
    31. fn:substring(string, begin, end)   
    32. 返回参数string部分字符串, 从参数begin开始到参数end位置,包括end位置的字符   
    33.   
    34. fn:substringAfter(string, substring)   
    35. 返回参数substring在参数string中后面的那一部分字符串   
    36.   
    37. fn:substringBefore(string, substring)   
    38. 返回参数substring在参数string中前面的那一部分字符串   
    39.   
    40. fn:toLowerCase(string)   
    41. 将参数string所有的字符变为小写,并将其返回   
    42.   
    43. fn:toUpperCase(string)   
    44. 将参数string所有的字符变为大写,并将其返回   
    45.   
    46. fn:trim(string)   
    47. 去除参数string 首尾的空格,并将其返回 


    截取字符串!使用!

     
    <c:if test="${fn:length(onebeans.info)>100 }">${ fn:substring( onebeans.info ,0,100)} ...</c:if>
     <c:if test="${fn:length(onebeans.info)<=100 }">${  onebeans.info }</c:if>


    posted @ 2012-06-14 14:38 wyx 阅读(29437) | 评论 (0)编辑 收藏