javaʵÏÖµÄftpÎļþÉÏ´«ÀýÌâ
1£ºÓÃhttpÐÒéÉÏ´«¸üÊʺÏweb±à³ÌµÄ·½±ã£»´«Ð¡ÓÚ1MÎļþËÙ¶ÈÒª±ÈÓÃftpÐÒéÉÏ´«ÎļþÂÔ¿ì¡£°²È«ÐԺ㻲»ÏñftpÄÇÑù£»±ØÐëÒªÆô¶¯Ò»¸öftp·þÎñ²ÅÐС£
2£ºÓÃftpÐÒéÉÏ´«Îļþ´óÓÚ1MµÄÎļþËٶȱÈhttp¿ì£»ÎļþÔ½´ó£»ÉÏ´«µÄËٶȾͱÈhttpÉÏ´«¿ìµÄ±¶ÊýÔ½´ó¡£¶øÇÒÓÃjava±àд³ÌÐò£»ftp±Èhttp·½±ã¡£ºÃ£¬·Ï»°ÉÙ˵£»ÎÒÃÇÏȴһ¸öʵÀýÀ´ÀíÐÔÈÏʶһÏÂÓÃjava±àдftpÉÏ´«ÎļþµÄ¼¼Êõ¡£
Ê×ÏÈÔÚ±¾»úÆô¶¯Ò»¸öftp·þÎñ£¬ftpµÄÓû§£º"IUSR_ZJH"
ÃÜÂ룺"123"£»ËæºóÔÚftpÖ÷Ŀ¼Ï½¨Ò»¸öÃûΪupftpµÄ×ÓĿ¼£»ÏÂÃæÓÐ4¸öÎļþ¾Í¿ÉÆô¶¯Õâ¸öÀýÌâÁË¡£
Îļþ1£ºMainCtrl.java£¨servletÎļþ£©ÄÚÈÝÈçÏ£º
import javax.servlet.http.HttpServlet;
import
javax.servlet.http.HttpServletRequest;
import
javax.servlet.http.HttpServletResponse;
import
javax.servlet.ServletException;
import java.io.FileInputStream;
import
java.io.IOException;
import sun.net.TelnetOutputStream;
import
sun.net.ftp.FtpClient;
public class MainCtrl extends HttpServlet
{
private FtpClient ftpClient;
public void
doPost(HttpServletRequest req, HttpServletResponse resp)
throws
ServletException, IOException {
resp.setContentType("text/html;
charset=UTF-8");
try {
//Á¬½Óftp·þÎñÆ÷
connectServer("127.0.0.1", "IUSR_ZJH", "123",
"upftp");
//ÉÏ´«Îļþ;²¢·µ»ØÉÏ´«ÎļþµÄÐÅÏ¢
req.setAttribute("inf",
upload(req.getParameter("file_name")));
} catch (Exception e)
{
System.out.println(e.toString());
req.setAttribute("inf",
e.toString());
req.getRequestDispatcher("view_inf.jsp").forward(req,
resp);
return;
} finally {
if (ftpClient != null) {
ftpClient.closeServer();
}
}
req.getRequestDispatcher("view_inf.jsp").forward(req, resp);
}
public void doGet(HttpServletR
Ïà¹ØÎĵµ£º
1.Java Ô´ÎļþÖÐ×î¶àÖ»ÄÜÓÐÒ»¸ö£¨£©À࣬ÆäËûÀàµÄ¸öÊý²»ÏÞ¡£
publicÀà,¶øÇÒÕâ¸öÀàµÄÀàÃûÒªºÍÎļþÃûÒ»ÖÂ.
2.ÃæÏò¶ÔÏó³ÌÐòÉè¼ÆµÄÌØÕ÷£¨·â×°ÐÔ£©£¨¼Ì³Ð£©£¨¶à̬ÐÔ£©
3.½Ó¿ÚÊÇÓÉ£¨³éÏó·½·¨£©ºÍ£¨³£Á¿£©×é³ÉµÄÌØÊâÀà
4.ÓÃstaticÐÞÊεķ½·¨ÊÇ£¨¾²Ì¬·½·¨£¬»òÀà·½·¨£©
5.ÔÚ²úÉúÒì³£µÄ·½·¨ÉùÃ÷ÖÐÉùÃ÷»á²úÉúµÄ ......
¡¡¡¡¡¡Spring Framework ¡¾Java¿ªÔ´ J2EE¿ò¼Ü¡¿
¡¡¡¡Spring ÊÇÒ»¸ö½â¾öÁËÐí¶àÔÚJ2EE¿ª·¢Öг£¼ûµÄÎÊÌâµÄÇ¿´ó¿ò¼Ü¡£ SpringÌṩÁ˹ÜÀíÒµÎñ¶ÔÏóµÄÒ»Ö·½·¨²¢ÇÒ¹ÄÀøÁË×¢Èë¶Ô½Ó¿Ú±à³Ì¶ø²»ÊǶÔÀà±à³ÌµÄÁ¼ºÃϰ¹ß¡£SpringµÄ¼Ü¹¹»ù´¡ÊÇ»ùÓÚʹÓÃJavaBeanÊôÐ﵀ Inversion of ControlÈÝÆ÷¡£È»¶ø£¬Õâ½ö½öÊÇÍêÕûͼ¾°ÖеÄÒ»²¿·Ö£ºSpringÔ ......
Èç¹û´Ó·¿´Thinking in java ÕâÊéËãÆð£¬ÄÇÎÒÒѾ¿´Á˲¶àÈý¸öÔÂÁË£¬µ«ÊÇÊÂʵÉÏÕæÕý°Ñ»¨ÔÚ˼¿¼JAVAÎÊÌâÉϵÄʱ¼äËãÏ£¬¿ÉÕæÊÇÈÃ×Ô¼º¶¼Óеã˵²»¹ýÈ¥¡£ÖÖÖÖÀíÓɶ¼³ä³â×ÅÎÒµÄÉñ¾£¬µ«Î޷Ƕ¼ÊÇÀÁ¶èÕßµÄ×ÔÎÒ±£»¤µÄÊֶΣ¬ÎÒ²»µÃ²»¸Ð¿®ÕæµÄÊÇ×Ô¼ºÌ«²»ÉϽøÁË¡£
&nbs ......
1, ±£Ö¤Ḭ̈߳²È«µÄÈýÖÖ·½·¨: a, ²»Òª¿çÏ̷߳ÃÎʹ²Ïí±äÁ¿b, ʹ¹²Ïí±äÁ¿ÊÇfinalÀàÐ͵Äc, ½«¹²Ïí±äÁ¿µÄ²Ù×÷¼ÓÉÏͬ²½
2, Ò»¿ªÊ¼¾Í½«ÀàÉè¼Æ³ÉḬ̈߳²È«µÄ, ±ÈÔÚºóÆÚÖØÐÂÐÞ¸´Ëü,¸üÈÝÒ×.
3, ±àд¶àÏ̳߳ÌÐò, Ê×Ïȱ£Ö¤ËüÊÇÕýÈ·µÄ, Æä´ÎÔÙ¿¼ÂÇÐÔÄÜ.
4, ÎÞ ......
1£® »ù±¾¿â
cxf-2.2.4.jar
XmlSchema-1.4.5.jar
Wsdl4j-1.6.2.java
2£® ÔÚ.NETÖбàд·þÎñ£¬Ä¬ÈϲÎÊý¼´¿É£¬È磺
namespace TestService2Java
{
[WebService(Namespace = "http://temp2java.org/")] //½ö´Ë´¦ÉÔ¼ÓÐ޸쬲»¸ÄÒ²¿É
[WebServiceBin ......