- 浏览: 26016 次
- 性别:
- 来自: 广州
-
最新评论
文章列表
List、Set、数组之间的转换
数组转Collection
使用Apache Jakarta Commons Collections:
importorg.apache.commons.collections.CollectionUtils;
String[] strArray = {"aaa", "bbb", "ccc"};
List strList = newArrayList();
Set strSet = new HashSet();
CollectionUtils.addAll(strList ...
去除数组中重复的元素
- 博客分类:
- java基础
public static String[] delRepeatElement(String[] str){
List list = new ArrayList();
for (int i=0; i
if(!list.contains(str[i])) {
list.add(str[i]);
}
}
return list.toArray(new String[1]);
}
例如:假设我们当前的地址是http://www.sina.com/admin/detail.jsp?id=5&type=7
HttpServletRequest request;
request.getRequestURL()得到的值是http://www.sina.com/admin/detail.jsp
request.getQueryString()得到的值是 id=5&type=7
request.getServletPath();//得到的值是 /admin/detail.jsp
request.getParameter("id") 5
...
类:
•Struts1要求Action类继承一个抽象基类。Struts1的一个普遍问题是使用抽象类编程而不是接口。
• Struts 2Action类可以实现一个Action接口,也可实现其他接口,使可选和定制的服务成为可能。Struts2提供一个ActionSupport基类去实现常用的接口。Action接口不是必须的,任何有execute标识的POJO对象都可以用作Struts2的Action对象。
线程模式:
• Struts1Action是单例模式并且必须是线程安全的,因为仅有Action的一个实例来处理所有的请求。单例策略限制了Struts1Action能作的事,并且要在开发时 ...
- 2013-07-18 23:08
- 浏览 399
- 评论(0)
var myArray=new Array();
myArray[0]="阿勒泰|Aletai|Aletai|ALT|AAT|中国|亚洲|China";
myArray[1]="兴义|Xingyi|Xingyi|XY|ACX|中国|亚洲|China";
myArray[2]="百色|Baise|Baise|BS|AEB|中国|亚洲|China";
myArray[3]="安康|Ankang|Ankang|AK|AKA|中国|亚洲|China";
myArray[4]="阿克苏|Akesu|Akesu|AKS ...
- 2013-07-18 23:04
- 浏览 428
- 评论(0)
判断当前查询的航班的使劲是不是合法的时间,即 不小于当前日期
function checkFightTime(fightTime){ //判断当前查询的航班的使劲是不是合法的时间,即 不小于当前日期 这里的时间是yyyy-MM-dd格式的
var fightTime = fightTime.replace("-", "/").replace("-", "/");//如果是yyyy/MM/dd直接跳过这一步
if(new Date(fightTime) < new Date()){
...
- 2013-07-18 23:00
- 浏览 338
- 评论(0)
json在javaweb中是一个很好的传输数据的工具,封装的数据一步了然
所需要的jar包下载地址:json-jar包(点击0积分下载)
js的代码
function saveOrder(){
var postMethod ;//邮寄方式
if($("#post_method").val==1){
postMethod = 1;
}else{
$("[name='company']").each(function(){
if(this.checked){
postMethod = this.id.substr(this ...
- 2013-07-16 23:12
- 浏览 577
- 评论(0)