`
Xue_zhang
  • 浏览: 10044 次
  • 性别: Icon_minigender_1
  • 来自: 邢台
社区版块
存档分类
最新评论
文章列表
class  ToHex1 { public static void main(String[] args) { toHex2(60); } public static void toHex2(int num){ char arr[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; char ar[]=new char[8]; int pos=ar.length; while(num!=0){ int temp = num & 15; ar[--pos]=arr ...
Ext.onReady(function(){ Ext.Msg.alert("提示","Ext.util.Format用法"); var teststr = "dasfhasjfhj" var teststr2 = "DAFGDfsy"; //capitalize将首字符串的第一个字母大写 var capitalizeResult = Ext.util.Format.capitalize(teststr); alert("capitalize()方法的功能:将首字符串的第 ...
1 获取: 1.1 字符串中包含的字符数,也就是字符的长度       int  length(); 1.2 根据位置获取位置上某个字符 char charAt(int index); 1.3 根据字符获取该字符在字符串上的位置 int indexOf(int ch);返回的是ch在字符串上第一次出现的位置 2 判断 2.1 字符串中是否包含某一个子串 boolean contains(str); 特殊之处:indexOf(str) 可以索引str第一次出现的位置,如果返回-1,表示该str不存在字符串中。 所以,也可以用于对制定判断是否包含。 ...
class ToHex { public static void main(String[] args) { toHex1(60); } public static void toHex1(int num){ StringBuffer sb= new StringBuffer(); for(int x=0;x<8;x++){ int temp=num&15; if(temp>9){ //System.out.println((char)(temp-10+'A')); sb.append((char)(temp-10+'A')); ...
class BinarySearch { public static void main(String[] args) { int arr[]={1,2,3,4,5,6,7,}; int temp=search(arr,2); System.out.println(temp); }          //折半查找前提是:数组必须是有序的 public static int search(int arr[],int key){ int min,max,mid; min=0; max=arr.length-1; mid=(min+max)/2; whil ...
class Found{ public static void main(String[] args){ int[] arr={1,2,3,4,5,6,7}; int temp=found(arr,43); if(temp==-1){ System.out.println("没有该数据"); } else{ System.out.println(temp); } }          //获取key值第一次出现在数组中的位置 public static int found(int arr[],int key){ for( ...
class SelectSort{ public  static void main(String[] args){ int arr[]={1,22,9,12,5,6,7}; bubble(arr); for(int x=0;x<arr.length;x++){ System.out.println(arr[x]); } } //冒泡排序 public static void bubble(int[] arr){ for(int x=0;x<arr.length;x++){ for(int y=0;y<arr.length-x-1;y ...
class SelectSort{ public  static void main(String[] args){ int arr[]={1,22,9,12,5,6,7}; select(arr); for(int x=0;x<arr.length;x++){ System.out.println(arr[x]); } } //选择排序 public static void select(int[] arr){ for(int x=0;x<arr.length-1;x++){ for(int y = x+1;y<arr.length;y+ ...
struts2 select标签的用法struts2的select标签中,常用的有以下几个属性: (1)struts2中的select 标签中,必须设置的属性只有一个,即是list。 (2)select标签的list中必须有值,不然会报错。如果没有值,可以加上headerKey, headerValue,这样就可以通过了。如: xml 代码<s:select   name="geElement.childType" list="childTypeList" listKey="key" listValue="val ...
使用xml文件完成属性的验证   一共有六个字段(也就是表单的六个属性).分别是 username ,password ,repassword ,age,birthday,graduation ..要求是 每个属性不能为空,前面三个必须在6到10个字符之间.年龄在1到150之间.birthday 为2001-01-01到2003-12-31之间,graduation在2005-01-01与2007-12-31之间..这些就是我们这节要实现的需求..   当然,还有其他需求,比如password与repassword必须相等,还有bithday必须在graduation之前.   配置x ...
web.xml <!-- 制定spring配置文件 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:beans.xml</param-value> </context-param> <!-- 对Spring容器进行实例化 --> <listener> <listener-class>org.springframework.we ...
使用Hibernate进行分页的实现[/color][/size][/align] 某个类---映射的表进行实现分页技术 查询的表的记录过程————————只是获取当前页的信息 首页:0-----4 当前页: 上一页:当前页-1 下一页:当前页+1 最后一页:末页 每页显示的记录数是多少呢? 5 查询当前页的信息     -------------------------------------     当前页在表中的起始位置及结束位置.     -------------------------------------- 递增序列   姓名                     ...

struts2文件上传

1 public String upload() { FileInputStream fis = null; FileOutputStream fos = null; String savePath = getSavepath(); File file = new File(savePath); if (!file.exists()) { file.mkdirs(); } try { fis = new FileInputStream(pic); fos = new FileOutputStream(file+"// ...
Global site tag (gtag.js) - Google Analytics