2.自己写一个方法,将test中的rep替换为with(不要使用jdk1.4.2自带的replace)。
public static string replace(string test,string rep,string with)4.如何将应用程序打包成JAR文件?
5.servlet如何实现定时操作?如何实现定时访问数据库?
6.写一个文件下载程序,并实现更改下载文件名称。
7.当internet后退时,会出现“警告,该网页已经过期”这是如何实现的?
8.如何读取orecle/mysql数据表中第10到20条记录?
9.数据库中两字符型字段相加,oracle/mysql如何实现?
10.谈谈对tomcat和websphere的认识。
11.structs有什么优缺点?

解决方案 »

  1.   

    问2:
    public class test {
        public static String replace(String test,String rep,String with){
            String [] str = test.split(rep);
            String newstr = "";
            for(int i=0;i<str.length;i++){
                 newstr += str[i]+with;
            }
            return newstr;
        }
        public static void main(String[] args) {
            String str1 = "helloworldhelloworldhelloworld";
            String str2 = "world";
            String str3 = "you";
            String str = test.replace(str1,str2,str3);
            System.out.println(str);
        }
    }
      

  2.   

    4、http://community.csdn.net/Expert/topic/4910/4910466.xml?temp=.5657465
      

  3.   

    5、http://community.csdn.net/Expert/topic/4723/4723057.xml?temp=4.951113E-02
      

  4.   

    问4:
    用jar命令,如果采用IDE的话,IDE中有打包工具,直接打包。
    问5:
    创建一个监听器,监听时间,到时间就去访问这个servlet。
    问7:
    应该是cookie失效,通过cookie_setMaxAge();来设置失效时间。
    问8:
    mysql中直接用select * from table where id>=10 and id<=20
      

  5.   

    8.select * from table_name where rownum>9 and rownum<21
      

  6.   

    4.jar cvf test.jar test
      

  7.   

    5.servlet如何实现定时操作?如何实现定时访问数据库?
    直接实现timer就可以了...
      

  8.   

    OnlyFor_love(『不给我分 就剪掉楼主小鸡几』) 
    你的算法有2个问题 ···1.当test中有多个rep连续出现的时候,结果里确只用一个with去替换。
    2.当test不是以rep结束的时候,结果会有一个with多余。
      

  9.   

    4. 用jar命令 或 ant build 或 一些IDE工具. jbuilder jdeveloper
      

  10.   

    11,个人认为,struts是个好东西,作为MVC的极端实现,使用他可以直接运用三层架够,同时,他的国际化,是作的非常漂亮的,为开发和模块维护提供了很好的方案,但是,这同时也是偶最不喜欢他的一点,当你维护或者修改一个成型的struts项目的时候,作为一个初学,或者对此项目不熟悉的人来说,页面上没有一句中文,全是标签...痛苦,可想而知了,另外,一个优秀的j2ee项目,美工是必不可少的,但是,现阶段,偶还没发现有美工的开发工具能...适应struts...呵呵
      

  11.   

    我倒很想听听struts的优缺点, 特别是缺点~
      

  12.   

    10.这个就更搞笑了,一个免费的和一个几十W一cpu的东东...tomcat很适合小访问量和实验室环境使用,同时,他不支持各种ejb、jmail、jms等额外服务(这点,jboss提供,所以……要$$),稳定性比不上那个几十万的东西,所以他们的运用方式不同,作为大型j2ee项目,websphere作为IBM的老牌产品,是个不错的选择,但是,个人的或者小型j2ee项目,tomcat或者基于tomcat的jboss集群就是一种不错的解决方案
      

  13.   

    8,前面已经有人回复了,偶作点补充
    select * from (select rownum as row_num,
    t.* from (你自己的查询语句) t where 
    rownnum < 数值) where row_num >= 数值;
      

  14.   

    6,说实话,偶不知道是虾米意思,如果是实现从数据库下载,那就是大字段和IO的问题,如果是网络下载,那就是用java写个网络蚂蚁?
      

  15.   

    第2问,我不用replace,是否可以用Pattern和Matcher?呵呵……另外,沙发的代码效率好低,至少也应该用个StringBuffer呀。
      

  16.   

    2.自己写一个方法,将test中的rep替换为with(不要使用jdk1.4.2自带的replace)。
    public static String replace(String test, String rep, String with) {
    StringBuffer sb = new StringBuffer();
    int bi = 0, ei = 0;
    while ((ei = test.indexOf(rep, bi)) > -1) {
    sb.append(test.substring(bi,ei));
    sb.append(with);
    bi = ei + rep.length();
    }
    sb.append(test.substring(bi));
    return sb.toString();
    }8.如何读取oracle/mysql数据表中第10到20条记录?
    oracle: 
    select * from country_region where rownum < 20
    minus
    select * from country_region where rownum < 10
    mysql: 
    select * from table1 limit 10,10;
    9.数据库中两字符型字段相加,oracle/mysql如何实现?
    oracle: select 'ab'||'cd' from dual;
    mysql: select concat('ab','cd');
      

  17.   

    我觉得问题八大家的答案有点不妥:
    可能存在id不是按顺序排列,要是人家的id是:1,3,5,7,9.....
    可能:select * from table where id>=10 and id<=20
    就不能奏效。
    mysql里面不是有一个:
    select * from table LIMIT 9,11
    就是查询第9行后(10行)的11条记录(10-20)。
    不晓得大家是什么意见。
      

  18.   

    2: public String replace(String str,String rep,String with)
    {
    StringBuffer newStr= new StringBuffer();
    int repLen = rep.length();
    int i=0;
    for(i=0;i<str.length()-repLen;i++)
    {
    if(str.substring(i,i+repLen).equals(rep))
    {
    newStr.append(with);
    if (repLen>1)
    i+=repLen-1;
    }
    else
    {
    newStr.append(str.substring(i,i+1));
    }
    }
    newStr.append(str.substring(i,str.length()));
    return newStr.toString();
    }
      

  19.   

    class  Kf
    {
    public static String replace(String test,String rep,String with)
    {
    StringBuffer str=new StringBuffer();
    int fromIndex=0;
    int start;
    while((start=test.indexOf(rep,fromIndex))!=-1)
    {
    String s=test.substring(fromIndex,start);
    str.append(s);
    str.append(with);
    fromIndex=start+rep.length();             
    }
    return str.toString();

    } public static void main(String[] args) 
    {
    String s1="abchhgdbc";
    String s2="bc";
    String s3="eee";

    System.out.println(replace(s1,s2,s3));
    }
    }
      

  20.   

    这个题目是星龙基的题目把
    我看struts的优点和缺点都在于他的taglib
      

  21.   

    8:select top 20 * from tablename where columename not in (select top 10 columename from table name)