保英更亮 发表于 2012-11-26 19:50:29

一个用JSP做的日历

用jsp编写文件上载

    如果你曾用VB编写文件上传的组件的话,那么用java编写文件上传的JAVABEAN十分容易。

    下面的例子只是一个简版

    package yuanyifileup;

    import java.io.*;

    import java.util.*;

    import javax.servlet.*;

    import javax.servlet.http.*;

    import javax.servlet.jsp.PageContext;

    public class yuanyifileup

    {www.bjkfp12.com,www.cckfp12.com,www.cskfp12.com,

    PRivate ServletRequest request;

    private ServletResp**e resp**e;

    private ServletConfig config;

    ServletInputStream DATA;

    int FormSize;

    File f1;

    FileOutputStream os;

    DataInputStream is;

    String filename;

    byte[] b;

    byte t;www.dlkfp12.com,www.hfkfp12.com,www.hzkfp12.com,

    boolean flag=false;

    public yuanyifileup()

    { www.jnkfp12.com, www.njkfp12.com, www.qdkfp12.com,
}

    public void initialize(ServletConfig config,HttpServletRequest request,HttpServletResp**e resp**e) throws IOException

    {

    this.request=request;

    this.resp**e=resp**e;

    this.config=config;

    DATA = request.getInputStream();

    FormSize=request.getContentLength(www.shkfp12.com,www.sykfp12.com,www.szkfp12.com);

    }

    public void initialize(PageContext pageContext) throws IOException

    {

    request=pageContext.getRequest();

    resp**e=pageContext.getResp**e();

    config=pageContext.getServletConfig();

    DATA = request.getInputStream();

    FormSize=request.getContentLength();

    }

    public boolean setFilename(String s)

    {

    try

    {

    File f1=new File(s);

    os=new FileOutputStream(f1);

    }

    catch(IOException e)

    {return(false);}

    return(true);

    }

    public void getByte()

    {

    int i=0;

    try

    {

    is=new DataInputStream(DATA);

    b=new byte;

    while (true)

    {

    try

    {

    t=is.readByte();

    b=t;

    i++;

页: [1]
查看完整版本: 一个用JSP做的日历