1、写一个方法实现下述功能,返回一个包含某一字符串中所有奇数位字符的字符串。for(int i=0;i<str.length;i++)
{
    if(i%2!=0)}

解决方案 »

  1.   

    sorry!for(int i=0;i<str.length;i++)
    {
        if(i%2!=0)
          out.println(str.charAt(i));
    }
      

  2.   

    2.select * from student where student_id not in(select student_id from books_loaned)
      

  3.   

    1.
    public String getOddStr(String sourceStr)
    {
    String srcStr = sourceStr;
    int returnStrLength = (srcStr.length() + 1 ) / 2;
    char[] tempc = new char[returnStrLength];

    for(int i = 0; i < returnStrLength; i++)
    {
    tempc[i] = srcStr.charAt(i*2);
    }
    return new String(tempc);
    }
    2.用no exist不知道怎么用,这是我的。
    SELECT student.student_id,student_name
    FROM books_loaned INNER JOIN student ON student.student_id=books_loaned.student_id
    WHERE books_loaned.book_number<>0;
    3.
    .
    .
    .
    <script language="JavaScript">
    function check()
    {
    var age = document.all.age.value;
    if (age > 80)
    {
    document.myform.age.value = "";
    window.alert("Error!  Age>80");
    }
    }
    </script>
    .
    .
    .
    <input name="age" type="text" id="age">
    <input type="submit" name="Submit" value="提交" onClick="check()">
    servlet题:
    (1)1
    (2)不知道
    XML题:

    结构良好的xml不一定是有效的xml。
    ⑵...
      

  4.   

    ⑵SAX和DOM的主要区别是什么?
    我的回答:前者比后者占用更少的资源,前者是在读取XML文的过程中生成模型
      

  5.   

    2、数据库题:有一学生表student(student_id,student_name)和一张图书借阅表books_loaned(student_id,book_number),请通过sql语句查找出从未借过一本书的学生的列表(请使用not exist关键字)答案: select * from student a where not exists (select 'x' from books_loaned where a.student_id=b.student_id)
      

  6.   

    severlet 第一题的答案  应该是4吧
      

  7.   

    1.
    public static String getOddString(String arg0)
    {
       if(arg0 == null) return null; //null判断,以免造成异常
       StringBuffer sb = new StringBuffer();
       for(int i=0;i<arg0.length();i+=2)  //这可以让循环的次数减少一半
         sb.append(arg0.charAt(i));
       return sb.toString();
    }
    2.这个查询比not in要快,利用表student的结果集减去books_loaned表的结果集
    select student_id,student_name from student
    minus
    select a.student_id,b.student_name from books_loaned a,student b
     where a.student_id = b.student_id
      

  8.   

    ⑵下面方法中哪几是servlet的生命周期方法()
    A.init()
    B.initial()
    C.service()
    D.delete()
    E.destrey()ACE
      

  9.   

    第三个编程有问题。ie里如果form只有一个input筐,不能通过javascript控制提交。弹出alert后无论如何都会提交.
      

  10.   

    1、写一个方法实现下述功能,返回一个包含某一字符串中所有奇数位字符的字符串。
       例如:ahbhchdheh   返回结果 abcde
             xaybz        返回结果 xyz
    public String oddString(String s){
       if(s==null) throw new NullPointerException();
       StringBuffer sb=new StringBuffer(s.length()/2+1);
       int i=0;
       while(i<s.length()){
          sb.append(s.chatAt(i));
          i+=2;
       }
       return sb.toString();
    }
    2、数据库题:有一学生表student(student_id,student_name)和一张图书借阅表books_loaned(student_id,book_number),请通过sql语句查找出从未借过一本书的学生的列表(请使用not exist关键字)
    select * from student as temp where not exitst(select temp.student_id from temp,books_loaned where temp.student_id = books_loaned)
    为什么要求用not exist??根本不需要  
    3、html&javascript题:请在下面的html中添加一个文本输入框(age)和一个提交按钮,同时添加javascript判断:当输入age大于80时,给出javascript提示信息。
    <html>
    <head></head>
    <body>
    <form name="myform" action="/servlet/myservlet" method="post"></form>
    </body>
    </html>
    这个问题还是算了
    servlet题:
    ⑴如果没有age参数给出,下面的语句会产生什么结果?
    <% String s=request.getParameter("age");
       out.println(s); %>
    A.NullpointerException occurs
    B.Page compiles but there is no output
    c.ServletException occurs
    d.null is printed on screen当然是d⑵下面方法中哪几是servlet的生命周期方法()
    A.init()
    B.initial()
    C.service()
    D.delete()
    E.destrey()
    a,c,e
    XML题:
    ⑴结构良好的XML和有效的XML有什么不同?
    不同方面吧,有效是语法,结构是设计
    ⑵SAX和DOM的主要区别是什么?
    实现技术不一样,我也忘了谁是谁了
      

  11.   

    ⑵SAX和DOM的主要区别是什么?
    SAX 是一种事件驱动的xml解析方式。每次访问一个xml文件中的某个节点的时候,sax就会搜索一遍xml文件,在找到相应的节点后就会触发一个事件来处理请求。  只读
    DOM 是一种基于树状的查找方式。DOM会将xml解析成一棵树,存在内存中。开发者可以通过查找树的节点来取得文件的内容或者修改内容。   可读写
      

  12.   

    怎么没人做servlet(1)啊
    选d
      

  13.   

    1、写一个方法实现下述功能,返回一个包含某一字符串中所有奇数位字符的字符串。
       例如:ahbhchdheh   返回结果 abcde
             xaybz        返回结果 xyz
    public String oddString(String s){
       if(s==null) throw new NullPointerException();
       StringBuffer sb=new StringBuffer(s.length()/2+1);
       int i=0;
       while(i<s.length()){
          sb.append(s.chatAt(i));
          i+=2;
       }
       return sb.toString();
    }
    2、数据库题:有一学生表student(student_id,student_name)和一张图书借阅表books_loaned(student_id,book_number),请通过sql语句查找出从未借过一本书的学生的列表(请使用not exist关键字)
    select * from student as temp where not exitst(select temp.student_id from temp,books_loaned where temp.student_id = books_loaned)
    为什么要求用not exist??根本不需要  
    3、html&javascript题:请在下面的html中添加一个文本输入框(age)和一个提交按钮,同时添加javascript判断:当输入age大于80时,给出javascript提示信息。
    <html>
    <head></head>
    <body>
    <form name="myform" action="/servlet/myservlet" method="post"></form>
    </body>
    </html>
    这个问题还是算了
    servlet题:
    ⑴如果没有age参数给出,下面的语句会产生什么结果?
    <% String s=request.getParameter("age");
       out.println(s); %>
    A.NullpointerException occurs
    B.Page compiles but there is no output
    c.ServletException occurs
    d.null is printed on screen当然是d⑵下面方法中哪几是servlet的生命周期方法()
    A.init()
    B.initial()
    C.service()
    D.delete()
    E.destrey()
    a,c,e
    XML题:
    ⑴结构良好的XML和有效的XML有什么不同?
    不同方面吧,有效是语法,结构是设计
    ⑵SAX和DOM的主要区别是什么?
    实现技术不一样,我也忘了谁是谁了
      

  14.   

    1,public String getNewstring(String s)
               {
               String newstring="";
               if(s!=null)
                   { 
                     for(int i=0;i<s.length;i++)
                         {
                            if(imode2!=0)
                               {
                                  newstring=newstring+s.charAt(i);
                                }
                          }
                     }
                 return newstring;
                }
    2,select * from student where student_id not in(select student_id from books_loaned)
    3,(1)D(2)ACE(3)(4)不懂
    添加body:
    <table>
      <tr>
         <td>
            <input type="text" name="age"/>
            <input type="submit" name="submit1" onclick="return sub()"/>
          </td>
       </tr>
    <script language="JavaScript">
    function sub()
    {
    var age = document.forms[0].age.value;
    if (age > 80)
    {
    window.alert("Error!  Age>80");
                       document.forms[0].age.focus();
                        return false;
    }
             return true;
    }
    </script>
                   
      

  15.   

    1.
    public String oddString(String s){
       if(s==null) throw new NullPointerException();
       StringBuffer sb=new StringBuffer(s.length()/2+1);
       int i=0;
       while(i<s.length()){
          sb.append(s.chatAt(i));
          i+=2;
       }
       return sb.toString();
    }
    2.select * from student where student_id not exists (select distinct student_id from books_loaned)
    3. 
    <script language="JavaScript">
    function check(form1)
    {
      if(form1.age.value > 80)
      {
        alert("error,age>80");
        return false;
       }
       return true;
    }
    </script>
    servlet:
    (1)A
    (2)a c e
      

  16.   

    第一道题java的String类中有个split方法这个很简单的就可以解决,不用谢很多代码的,或用replace好了
    题2 看看书就好了
    题3 肯定是空指针的错误 a
    题4 ac 吧 这个忘的差不多了
    xml题 sax 流传输机制,占用资源少,但想要快速重复捕捉节点不方便
          dom 会在内存中形成一个大的树形缓存,非常占用资源,但可方便快速访问,操作简便
      

  17.   

    哦,忘了javascript当遇到文本内容小于80的情况时写个alert就好了
      

  18.   

    select * from student where student_id not in(select student_id from books_loaned)
      

  19.   

    请问 showstv(0!0):
    select * from student a where not exists (select 'x' from books_loaned where a.student_id=b.student_id)中的'x'代表什么?
      

  20.   

    select * from student as s1
    where not eixsts
    (select * from student as s2
       where s2.student_id = s1.student_id)
      

  21.   

    上面那个弄错了select * from student 
    where not eixsts
    (select * from books_loans
       where student.student_id = books_loans.student_id)
      

  22.   

    恩,纠正了我的一个理解错误,我一直以为getParameter取不到就报错。
      

  23.   

    function check(form1)
    {
      if(form1.age.value > 80)
      {
        alert("error,age>80");
        return false;
       }
       return true;
    }
    </script>value.length>80
      

  24.   

    function check(form1)
    {
      if(form1.age.value > 80)
      {
        alert("error,age>80");
        return false;
       }
       // 这一句不要吧return true;
    }
    </script>