2012年8月25日
摘要: 表关系图:需求:我想要查询的数据结果是:我们可以内连接:select s.id,s.name,srt.typeId, stt.name as TypeName from scenics as sINNER JOIN(select * from scenics_type) srt on srt.scenicsId=s.idINNER JOIN(SELECT * from scenicstype where deleted=0)stt on stt.id=srt.typeId得到结果是:显然我们需要分组,合并一下数据。select s.id,s.name,srt.typeId, stt.nam.. 阅读全文
posted @ 2012-08-25 10:27 上善若水123 阅读(4305) 评论(0) 推荐(0) 编辑
  2012年8月22日
摘要: 在项目开发时,如果采用了Spring的自动装配时,有时我们在封装自定义JSP标签时,会用到服务层的方法,这是我们需要通过Spring IOC来获取实例,这时我们可以获取Spring IOC中一个比较关键的对象:ApplicationContext 代码如下: public static Object getBean(String name){ ApplicationContext conn=(ApplicationContext) ServletActionContext.getServletContext().getAttribute(WebApplicationCon... 阅读全文
posted @ 2012-08-22 19:56 上善若水123 阅读(431) 评论(0) 推荐(0) 编辑
摘要: Struts标签在FreeMarKer 中使用和JSP中是一点不同的。 引用Struts标签库。<#assign s=JspTaglibs["/WEB-INF/struts-tags.tld"]> 在JSP中<s:select name="list" list="{'Java','.Net'}" value="'Java'"/> 在FreeMarker 中: 静态数据源:<@s.select name="person.delet 阅读全文
posted @ 2012-08-22 19:50 上善若水123 阅读(1871) 评论(6) 推荐(2) 编辑
  2012年8月17日
摘要: rapid-generator 资源http://code.google.com/p/rapid-framework/步骤一:新建一个项目,写生成的代码。package hello;import cn.org.rapid_framework.generator.GeneratorFacade;public class aa { public static void main(String[]args)throws Exception{ GeneratorFacade g = new GeneratorFacade(); g.deleteOutRootDir()... 阅读全文
posted @ 2012-08-17 13:43 上善若水123 阅读(14472) 评论(0) 推荐(1) 编辑
  2011年11月21日
摘要: 完全通过配置实现AOP的资料太少了,今天忙了好几个小时终于走通了,分享一下。 模拟业务是:登陆,记录登陆日志。// 业务接口 public interface IStudentManage { bool Login(string userId, string userName); } public class StudentManage:IStudentManage { public StudentManage() { } public bool Login(string userId, string userName) ... 阅读全文
posted @ 2011-11-21 15:39 上善若水123 阅读(1182) 评论(0) 推荐(1) 编辑
  2011年10月18日
摘要: 一个显式实现的小例子public interface ISay { void CanSay(); } public class Man : ISay { /// 显式实现接口 void ISay.CanSay() { Console.WriteLine("New:I can say!"); } public void CanSay() { Console.WriteLine("Old:I can say!"); } ... 阅读全文
posted @ 2011-10-18 19:54 上善若水123 阅读(237) 评论(0) 推荐(0) 编辑
  2011年10月15日
摘要: 一个例子代码 // 抽象类型 public abstract class Man { // 对抽象方法参数验证,以后所有子类中都不需要重复的参数验证(如果以后其他人要用重写你的抽象方法,他会感谢你的) public string Say(string message) { if (string.IsNullOrEmpty(message)) return "我不想说话!"; return SayHi(message); } prot... 阅读全文
posted @ 2011-10-15 08:51 上善若水123 阅读(269) 评论(0) 推荐(1) 编辑
  2011年9月29日
摘要: 前几天面试遇到一个关于兔子的面试题。回来上网一搜有很多类似的问题。于是就总结一下这类问题的解决方法。 题目:有一对兔子经过两个月长大,在第三个可以生下一对小兔子。小兔子在经过两个月也可以生下一对小兔子。成年一对兔子每个月都可以生一对小兔子如果成年兔子可以无限生下去,问:第几个月有多少多少兔子?实现代码:spublic static int GetCount(int monthNum) { if (monthNum <= 0) return 0; // 能够生小兔子的成年兔 int canProduce = 0; // 0个月大的小兔子 int zero= 2; // 1个月大的小兔子 i 阅读全文
posted @ 2011-09-29 09:20 上善若水123 阅读(520) 评论(0) 推荐(0) 编辑
  2011年9月20日
摘要: /// <summary> /// 读取excel /// </summary> /// <param name="filePath"></param> /// <returns></returns> public static DataSet getExcelData(string filePath, ref string error) { try { string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" 阅读全文
posted @ 2011-09-20 18:37 上善若水123 阅读(384) 评论(0) 推荐(0) 编辑
  2011年9月14日
摘要: js 对iframe高的控制function SetCwinHeight(frameID) { var iframeid = window.document.getElementById(frameID); //iframe id if (document.getElementById) { if (iframeid && !window.opera) { if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight) { iframeid.height = iframeid 阅读全文
posted @ 2011-09-14 09:29 上善若水123 阅读(384) 评论(3) 推荐(1) 编辑