update table 记录到表字段

解决方案 »

  1.   

    我知道是把该歌曲的某字段++;
    但是我就是不知道在什么时候去调beans里的++函数。我在beans里写了把该字段加1的函数,
    如果说页面上一个连接直接连到mp3那我怎么调函数啊?
    如果说转到另一个页面调beans我又不知道怎么让人家下载了。
      

  2.   

    如果你的下载直接把mp3路径给连接上了,那么你最好在连接上加一个script函数,对方点击的时候调用你的++函数,其实最好还是提供一个专门下载的页面,在那里控制。
      

  3.   

    这是一个计数器的例子,,看看也许有用~~
    <% 
    BufferedReader inf = new BufferedReader(new FileReader("/path/to/counter.txt"));
    int tmp = Integer.parseInt(inf.readLine());
    int i=0;try {i = Integer.parseInt(request.getSession().getValue("tal").toString());
    } catch (NullPointerException t) {i=0; }if (i==0) {
    tmp++;PrintWriter outf = new PrintWriter(new BufferedWriter(new FileWriter("/path/to/counter.txt")));
    outf.println(tmp);
    outf.close();
    inf.close();
    request.getSession().putValue("tal", "1");
    }BufferedReader inf2 = new BufferedReader(new FileReader("/path/to/counter.txt"));
    %>
    <%
    String zeroes="";
    String hits = inf2.readLine();
    inf2.close();
    for (int t=0; t < 8-hits.length(); t++) {
    zeroes=zeroes+"0"; }
    out.println(zeroes + hits);
    %>
      

  4.   

    一个用jspsmart下载的例子自己看看吧!
    <%@ page contentType="text/html;charset=gb2312" language="java"  import="java.sql.*"%><%@page import="com.jspsmart.upload.*" %><jsp:useBean id="brchange" scope="page" class="user.sql.BRchange"/><%
         String  file_path="/docstore/",file_name,sourceFile;
         file_name=request.getParameter("file_url");
     
     if(file_name!=null){
      file_name=brchange.getStr(file_name);
      //out.println(file_name);
              sourceFile=file_path+file_name;
           // 新建一个SmartUpload对象
              SmartUpload su = new SmartUpload();
            // 初始化
              su.initialize(pageContext);
            // 设定contentDisposition为null以禁止浏览器自动打开文件,
               //保证点击链接后是下载文件。若不设定,则下载的文件扩展名为
             //doc时,浏览器将自动用word打开它。扩展名为pdf时,
              //浏览器将用acrobat打开。
              su.setContentDisposition(null);
             // 下载文件
              su.downloadFile(sourceFile);
    }
    %>
      

  5.   

    com.jspsmart.upload.*
    user.sql.BRchange
    SmartUpload
    这些类是java自带的还是自定义的?