随笔分类 -  java

java 知识分享
摘要:package org.test;public class Sushu { /** * @param args */ static boolean isPrime(int number){ boolean ispnum=true; for(int i=2;i<=Math.sqrt(number);i++){ if(number%i==0){ ispnum=false; } } return ispnum; } public static void main(String[] args) { // TODO Auto-generated method stub ... 阅读全文

posted @ 2013-03-05 15:19 juan1206 阅读(214) 评论(0) 推荐(0)

摘要:<logic:iterate>标记用于在页面中创建一个循环,以此来遍历如数组、Collection、Map这样的对象。该标记的功能强大,在Struts应用的页面中经常使用到。1、对数组进行循环遍历使用<logic:iterate>标记可以用于遍历数组,以下是一段示例代码:<%String[] testArray={"str1","str2","str3"}; pageContext.setAttribute("test",testArray); %><logic:itera 阅读全文

posted @ 2013-02-06 15:38 juan1206 阅读(688) 评论(0) 推荐(0)

摘要:String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();这其实就是 获得应用的根url,比如说你的应用的根路径是 http://localhost:8080,那么你列出的代码就是为basePath赋值为 http://localhost:8080。具体点: 1、request.getScheme() 返回协议的名称 http,和后面的"://" 拼起来 阅读全文

posted @ 2012-12-18 11:54 juan1206 阅读(175) 评论(0) 推荐(0)

摘要:1.以空格作为截取的条件String s="aaa bbb ccc";String[]strs=s.split("");然后strs[0]就是aaa,strs[1]就是bbb。。。2.截取字符串最后两个字符串String s="titleChooseAA"str=str.substring(str.length()-2, str.length());结果为:AAps:未完待续。。。。。。 阅读全文

posted @ 2012-12-11 14:30 juan1206 阅读(135) 评论(0) 推荐(0)

摘要:原因是sql或hql拼接有问题错误代码: public GemStorageHistory gemid(String code){ List<GemStorageHistory> list=this.daoPersistence.query("from GemStorageHistory gh where gh.gemStorageCode="+code); return list.size()>0?list.get(0):null; }错误原因:拼接字符串有误:gh.gemStorageCode="+code正确方法: public GemSt 阅读全文

posted @ 2012-11-29 15:35 juan1206 阅读(2521) 评论(0) 推荐(0)

摘要:Response.Write( " <script> alert( 'testing! ') </script> ");Response.Redirect( "savrok.aspx ");这种方式是错误的,只会跳转,不能弹出对话框。正确的写法是this.Response.Write(" <script language=javascript>alert('" + m_message + "');window.location.href= 'ksbm 阅读全文

posted @ 2012-11-22 17:20 juan1206 阅读(967) 评论(5) 推荐(1)

该文被密码保护。

posted @ 2012-11-21 15:25 juan1206 阅读(33) 评论(0) 推荐(0)

该文被密码保护。

posted @ 2012-11-17 11:04 juan1206 阅读(630) 评论(0) 推荐(0)

摘要:1. 冒泡排序package SortAlgorithm;import java.util.Arrays;/*** 冒泡排序* * @author yinger*/public class BubbleSort { public static void main(String[] args) { int[] s = new int[] { 10, 23, 43, 9, 25, 87, 56, 34, 11 }; System.out.println("Before: " + Arrays.toString(s));// Before: [10, 23, 43, 9, 25, 阅读全文

posted @ 2012-11-17 10:46 juan1206 阅读(166) 评论(0) 推荐(0)

摘要:js文件 function udpateCommtiy(id,param) { $.post("/background/savegemStorage.do?param=updateState&bean.id="+id+"&bean.gemstoneState="+param,function(m){ if(m=="true") { $("#"+id).html("下架"); }else { $("#"+id).html("上架"); } } 阅读全文

posted @ 2012-11-08 19:39 juan1206 阅读(253) 评论(0) 推荐(0)

摘要:Java时间格式转换大全import java.text.*;import java.util.Calendar;public class VeDate {/** * 获取现在时间 * * @return 返回时间类型 yyyy-MM-dd HH:mm:ss */public static Date getNowDate() { Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateStr... 阅读全文

posted @ 2012-10-23 14:43 juan1206 阅读(289) 评论(0) 推荐(0)

摘要:方法一关键代码:<form action="" method="post" enctype="multipart/form-data" name="form1"><img src=" " name="image" border=0 id="img"/><br /><input name="picture" type="file" id="picture" 阅读全文

posted @ 2012-10-22 15:37 juan1206 阅读(190) 评论(0) 推荐(0)

摘要:char charAt(int index) 返回指定索引处的 char 值。 int codePointAt(int index) 返回指定索引处的字符(Unicode 代码点)。 int codePointBefore(int index) 返回指定索引之前的字符(Unicode 代码点)。 int codePointCount(int beginIndex, int endIndex) 返回此 String 的指定文本范围中的 Unicode 代码点数。 int compareTo(String anotherString) 按字典顺序比较两个字符串。 int compareT... 阅读全文

posted @ 2012-10-22 10:01 juan1206 阅读(180) 评论(0) 推荐(0)

摘要:http://blog.sina.com.cn/s/blog_5b01be8c0100gs9j.html页面介绍了fmt标签的用法。。。。 分享帖。。 阅读全文

posted @ 2012-10-18 11:27 juan1206 阅读(175) 评论(0) 推荐(0)

摘要:SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); out.println(format.format(new Date()));显示格式为:2012-10-15 15:06:19 阅读全文

posted @ 2012-10-15 15:13 juan1206 阅读(149) 评论(0) 推荐(0)

导航