08 2013 档案
摘要:请看如下红色部分,show为mysql的保留字,所以我在hibernate修改show字段值的时候出现错误,原来是show跟mysql的保留字相同了CREATETABLE`t_letter`(`lid`int(11)NOTNULLAUTO_INCREMENTCOMMENT'主键',`title`varchar(200)DEFAULTNULLCOMMENT'留言标题',`content`textCOMMENT'留言内容',`time`datetimeDEFAULTNULLCOMMENT'留言时间',`status`int(11)DE
阅读全文
摘要:-Xms300m -Xmx400m -XX:PermSize=128M -XX:MaxNewSize=256m -XX:MaxPermSize=256M
阅读全文
摘要:一般来说使用jsp标签引入一个jsp文件:①可以在被引入的jsp中加入:②在当前项目的web.xml中加入: jsp encoding example JSPConfiguration *.jsp false UTF-8 JSPConfiguration *.html false UTF-8 ...
阅读全文
摘要:column注解中的columnDefinition属性用于覆盖数据库DDL中的语句:(MySql) @Column(columnDefinition = "int(11) DEFAULT NULL COMMENT '类型'") public Integer getType() { return type; }因此,又可以为该列添加comment注释。然而,columnDefinition不推荐使用,因为可能导致移植性不好,各个数据库不兼容等。
阅读全文
摘要:@Id @SequenceGenerator(name="increment") @GeneratedValue(strategy=GenerationType.AUTO, generator="increment") public Integer getId() { return id; }经测试,MySql数据库可用。
阅读全文
摘要:1 import org.junit.Test; 2 3 import java.io.*; 4 5 /** 6 * User: HYY 7 * Date: 13-8-18 8 * Time: 下午8:11 9 * To change this template use File | Settings | File Templates.10 */11 public class ReplaceStr {12 private File fileRootDir = new File("D:\\ahgw\\src\\com\\ahgw");//根目录文件13 priva...
阅读全文
摘要:读取模板的时候有一个编码:Template template = this.tempConfiguration.getTemplate(templatePath,"UTF-8");生成文件的时候使用编码:Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(htmlFile), "UTF-8"));附(freeMarker生成静态文件的代码):public class MakeHtml { private Configuration tempConfigur
阅读全文
摘要:package com.baoxiu.test;import java.io.BufferedReader;import java.io.InputStreamReader;import java.io.PrintWriter;import java.net.URL;import java.net.URLConnection;/*** 发送URL的post请求* User: HYY* Date: 13-8-16* Time: 下午4:44* To change this template use File | Settings | File Templates.*/public class S
阅读全文
摘要:在此使用firebug进行操作:打开firebug的“网络”标签,并激活该功能。然后在注册页面中输入手机号码后点击发送。然后在面板中可以发现发送信息的链接,查看使用get还是post方式获取,并点击该标签,得到各个参数信息和源代码(请求的参数),在java中模拟发送post或者get请求即可。
阅读全文
摘要:SSH hibernate 使用时最好添加访问数据库的编码如下所示:第13行为设置hibernate访问数据库的编码(&是&的转义序列) 1 4 5 6 7 8 9 10 com.mysql.jdbc.Driver11 12 13 jdbc:mysql://localhost:3306/hibernatetest?useUnicode=true&characterEncoding=UTF-814 15 root16 ...
阅读全文
摘要:Hibernate关于sql中的count(*)数据统计:①如果使用的是HQL:直接在HQL中使用count(*)即可获取行数 Long count = (Long)HibernateUtil.getSession() .createQuery("select count(*) from Employee") .uniqueResult(); System.out.println(count); ②如果使用的是Criteria方式查询:使用Projections.rowCount()方法 ...
阅读全文
摘要:JDK5以后Integer a = 3; 这是自动装箱int i = new Integer(2); 这是自动拆箱就是基本类型和其对应的包装类型在需要的时候可以互相转换,具体过程由编译器完成比如自动装箱:Integer a=3;其实编译器调用的是static Integer valueOf(int i)这个方法查阅JDK知道,valueOf(int i)返回一个表示指定的int 值的Integer 对象那么就变成这样: Integer a=3; => Integer a=Integer.valueOf(3);对应的 int intValue() 返回该Integer对象的int值,是拆箱
阅读全文
摘要:这是一个文件下载的action,红色部分为火狐浏览器需要特地做的事情。@Controller@Scope(value = "prototype")public class FormManage_downloadAction { private String fileName;//下载文件时候的名称 private String filePath;//文件在磁盘的路径 public String execute() throws UnsupportedEncodingException { System.out.println("下载action"); .
阅读全文
摘要:/formManage/download.do?filePath=${filePath}&fileName=${fileName} 红色部分即“&”符号,因为xml中转义问题(& -> &)所以传参的时候要注意了
阅读全文
摘要:IText生成doc文档需要三个包:iTextAsian.jar,iText-rtf-2.1.4.jar,iText-2.1.4.jar亲测无误,代码如下所示:import com.lowagie.text.*;import com.lowagie.text.Font;import com.lowagie.text.Rectangle;import com.lowagie.text.pdf.BaseFont;import com.lowagie.text.pdf.PdfPCell;import com.lowagie.text.pdf.PdfPTable;import com.lowagie.
阅读全文
摘要:IText生成doc文档需要三个包:iTextAsian.jar,iText-rtf-2.1.4.jar,iText-2.1.4.jar亲测无误,代码如下:import com.lowagie.text.*;import com.lowagie.text.Rectangle;import com.lowagie.text.rtf.RtfWriter2;import java.io.FileOutputStream;/** * 纸张方向横向测试 * User: HYY * Date: 13-8-1 * Time: 下午9:54 * To change this template use File
阅读全文
摘要:昨晚寻找了网上很多关于IText表格居中问题,他们其中的有些代码我即使复制上去生成的doc表格的文字都是不居中的,后来我自己找出了一种居中方式:为PdfPCell对象添加paragraph对象,并将该paragraph设置为居中: PdfPCell cell1 = new PdfPCell(); Paragraph para = new Paragraph("该单元居中"); //设置该段落为居中显示 para.setAlignment(1); cell1.setPhrase(para); table.addCell(cell1);代码亲测无误,全部代码如下:import
阅读全文
摘要:IText生成doc文档需要三个包:iTextAsian.jar,iText-rtf-2.1.4.jar,iText-2.1.4.jar亲测无误,代码如下:import com.lowagie.text.Document;import com.lowagie.text.Font;import com.lowagie.text.PageSize;import com.lowagie.text.Paragraph;import com.lowagie.text.pdf.BaseFont;import com.lowagie.text.rtf.RtfWriter2;import org.junit.
阅读全文
摘要:做doc文档报表的时候可能遇到这样的需求:每一个页面需要页码,用IText可以完成这样的需求。IText生成doc文档需要三个包:iTextAsian.jar,iText-rtf-2.1.4.jar,iText-2.1.4.jar代码亲测无错,如下所示:import com.lowagie.text.*;import com.lowagie.text.Font;import com.lowagie.text.rtf.RtfWriter2;import java.awt.*;import java.io.FileOutputStream;/*** 生成页脚页码* User: HYY* Date:
阅读全文
摘要:javascript函数的参数包含另一个函数的情形:运行结果:第一次弹出窗口:1第二次弹出窗口:函数a结论:在javascript中,函数的参数可以为另一个函数的引用
阅读全文
摘要:struts2配置文件中action的name属性的第一个字符不要加斜杠 /admin/business/baoxiuManage/see.jsp如果name="/see"则是错误的写法。
阅读全文
摘要:如果t_message表和t_user_has_message表通过字段id和messageId相关联,并且打算删除这两张表拥有共同关联id的数据,可以使用SQL语句:DELETE m, uhm FROM t_message AS m, t_user_has_message AS uhm WHERE uhm.messageId = m.id AND m.id IN (1,2,3)即可删除两表的且id为1,2,3的数据
阅读全文