随笔分类 -  Java

摘要:public class RMB { //返回转换好的大写形式 public static String numberToRMB(String money) { return cleanZero(splitNum(roundString(money))); } ... 阅读全文
posted @ 2014-11-20 08:57 yshy 阅读(310) 评论(0) 推荐(0)
摘要:主要通过Java反射机制实现。例如:public class NewClass { private static final NewClass newClass = new NewClass(); public void doTest(String methodName){ ... 阅读全文
posted @ 2014-11-18 09:01 yshy 阅读(1604) 评论(0) 推荐(0)
摘要:1:现在笔记本上安装的是,执行java -version:2:现在又安装了,想通过修改环境变量,使JDK切换到1.6版本上JDK的安装目录:D:\Java\修改环境变量:(1)JAVA_HOME=>D:\Java\jdk6(之前是jdk7);(2)CLASSPATH=>.;%JAVA_HOME%\l... 阅读全文
posted @ 2014-11-09 09:11 yshy 阅读(349) 评论(0) 推荐(0)
摘要:/** * 比较两个日期的大小: * 2 发生异常 * 1 firstDate>secondDate * 0 firstDate==secondDate * -1 firstDatesDate.getTime()){ result... 阅读全文
posted @ 2014-09-28 14:57 yshy 阅读(675) 评论(0) 推荐(0)
摘要:HttpClient client = new HttpClient(); GetMethod get = new GetMethod(URL); get.setRequestHeader("Content-Type","application/x-www-fo... 阅读全文
posted @ 2014-09-24 11:14 yshy 阅读(3557) 评论(0) 推荐(0)
摘要:/** * @Description: 当前日期加上n个月返回long date */ public static long getLongDateAddMonth(int n){ Calendar cd=Calendar.getInstance(); ... 阅读全文
posted @ 2014-08-25 16:20 yshy 阅读(612) 评论(0) 推荐(0)
摘要:Set> aSet = map.entrySet(); Iterator> iter = aSet.iterator(); while(iter.hasNext()){ ... 阅读全文
posted @ 2014-08-19 17:20 yshy 阅读(143) 评论(0) 推荐(0)
摘要:1:测试数据库表usermysql> desc user$$+-------+-------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra ... 阅读全文
posted @ 2014-07-02 15:29 yshy 阅读(2036) 评论(0) 推荐(0)
摘要:需要以下jar包:---log4jcommons-loggin-1.1.1.jarlog4j-1.2.16.jar---mysqlmysql-connector-java-5.1.15-bin.jar---log4j.properties配置内容log4j.rootLogger=INFO,DATAB... 阅读全文
posted @ 2014-06-19 15:32 yshy 阅读(428) 评论(0) 推荐(0)
摘要:例如在mysql中的一张表中存在一个字段opr_time为datetime类型,在JDBC 中通过rs.getString("opr_time");来获取使会在日期后面添加".0",例如日期为:2014-06-01 12:10:20 查询出来为:2014-06-01 12:10:20.0解决方法:通... 阅读全文
posted @ 2014-06-06 17:16 yshy 阅读(3878) 评论(0) 推荐(0)
摘要:iText下载链接:http://sourceforge.net/projects/itext/files/会有两个文件夹:extrajars中的extrajars-2.3.jar文件用于解决中文不显示的问题。将下载的itext-5.5.1文件解压之后,将itextpdf-5.5.1.jar导入就可... 阅读全文
posted @ 2014-05-31 10:59 yshy 阅读(3418) 评论(0) 推荐(0)
摘要:实例代码如下: String str = null; String uSelectDate = String.valueOf(str); System.out.println("==================uSelectDate:"+uSelectD... 阅读全文
posted @ 2014-05-28 08:20 yshy 阅读(495) 评论(0) 推荐(0)
摘要:例如:有一个字符串:"数量最低2000份",将其中的2000数字提取出来。 String arg0 = "数量最低2000份"; Pattern p = Pattern.compile("\\d+"); Matcher m = p.matcher(arg0); ... 阅读全文
posted @ 2014-05-07 14:19 yshy 阅读(1373) 评论(0) 推荐(0)
摘要:服务端采用gzip对文本内容进行压缩处理,客户端使用HttpClient获取数据并进行gzip解压缩。一: 服务端public class GzipTestServlet extends HttpServlet { protected void processRequest(HttpSer... 阅读全文
posted @ 2014-05-05 18:54 yshy 阅读(3358) 评论(0) 推荐(1)
摘要:public int addWsstxCotent(final WsstxContent wsstxContent) { final String sql = "insert into wsstx_content(sstx_type,sstx_content,sstx_titl... 阅读全文
posted @ 2014-04-20 10:42 yshy 阅读(789) 评论(0) 推荐(0)
摘要:1:所需jar包2:Mysql数据库表内容如下:3:代码结构如下:(1)User.javapublic class User { private int id; private String name; private String no; private String nativePlace; private String edu; private Double math; private Double computer; private Double english; private Double sumcount; privat... 阅读全文
posted @ 2014-04-02 17:29 yshy 阅读(530) 评论(0) 推荐(0)
摘要:开发环境:NetBeans7.4Tomcat 6.0.32一 服务端:1:新建JavaWeb工程 cxfspring-server,导入jar包如下图所示:2:在web.xml文件中添加如下配置项: contextConfigLocation classpath:spring-config.xml org.springframework.web.context.ContextLoaderListener CXFServlet org.apache.cxf.transport.servl... 阅读全文
posted @ 2014-03-30 12:01 yshy 阅读(1359) 评论(0) 推荐(0)
摘要:三月 30, 2014 10:06:40 上午 org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames信息: Created classes: com.test.server.HelloWorld, com.test.server.HelloWorldResponse, com.test.server.ObjectFactoryException in thread "main" org.apache.cxf.common.i18n.UncheckedException: No operation was fo 阅读全文
posted @ 2014-03-30 10:23 yshy 阅读(7656) 评论(1) 推荐(2)
摘要:严重: Error listenerStart2014-3-29 22:25:20 org.apache.catalina.core.StandardContext start严重: Context [/cxfspring] startup failed due to previous errors at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) at... 阅读全文
posted @ 2014-03-29 22:32 yshy 阅读(2407) 评论(0) 推荐(0)
摘要:说明:在使用Tomcat6.0.32+Spring3.05+Quartz1.8.6+Mysql5.5.9 此项目在我本机上没有问题,当我把mysql 脚本导入到服务器上,将数据源配置修改为服务器对应的mysql时,再次运行程序出现以下问题,错误信息如下:严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCrea 阅读全文
posted @ 2014-03-24 10:19 yshy 阅读(5644) 评论(0) 推荐(0)