Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : java

Java±à³ÌËöÊ£¨9£©——Êý¾Ý¿âÁ¬½Ó³Ø


Ò»¡¢Êý¾Ý¿âÁ¬½Ó³Ø¹¤×÷Ô­Àí£º
1.         ¶ÔÓÚ¹²Ïí×ÊÔ´£¬ÓÐÒ»¸öºÜÖøÃûµÄÉè¼Æģʽ£º×ÊÔ´³Ø£¨Resource Pool£©¡£¸ÃģʽÕýÊÇΪÁ˽â¾ö×ÊÔ´µÄƵ·±·ÖÅä﹑ÊÍ·ÅËùÔì³ÉµÄÎÊÌ⡣Ϊ½â¾öÉÏÊöÎÊÌ⣬¿ÉÒÔ²ÉÓÃÊý¾Ý¿âÁ¬½Ó³Ø¼¼Êõ¡£Êý¾Ý¿âÁ¬½Ó³ØµÄ»ù±¾Ë¼Ïë¾ÍÊÇΪÊý¾Ý¿âÁ¬½Ó½¨Á¢Ò»¸ö“»º³å³Ø”¡£Ô¤ÏÈÔÚ»º³å³ØÖзÅÈëÒ»¶¨ÊýÁ¿µÄÁ¬½Ó£¬µ±ÐèÒª½¨Á¢Êý¾Ý¿âÁ¬½Óʱ£¬Ö»Ðè´Ó“»º³å³Ø”ÖÐÈ¡³öÒ»¸ö£¬Ê¹ÓÃÍê±ÏÖ®ºóÔÙ·Å»ØÈ¥¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÉ趨Á¬½Ó³Ø×î´óÁ¬½ÓÊýÀ´·ÀֹϵͳÎÞ¾¡µÄÓëÊý¾Ý¿âÁ¬½Ó¡£¸üΪÖØÒªµÄÊÇÎÒÃÇ¿ÉÒÔͨ¹ýÁ¬½Ó³ØµÄ¹ÜÀí»úÖƼàÊÓÊý¾Ý¿âµÄÁ¬½ÓµÄÊýÁ¿﹑ʹÓÃÇé¿ö£¬ÎªÏµÍ³¿ª·¢﹑²âÊÔ¼°ÐÔÄܵ÷ÕûÌṩÒÀ¾Ý¡£
2.         JDBCµÄAPIÖÐûÓÐÌṩÁ¬½Ó³ØµÄ·½·¨¡£Ò»Ð©´óÐ͵ÄWEBÓ¦Ó÷þÎñÆ÷ÈçBEAµÄWebLogicºÍIBMµÄWebSphereµÈÌṩÁËÁ¬½Ó³ØµÄ»úÖÆ£¬µ«ÊDZØÐëÓÐÆäµÚÈý·½µÄרÓÃÀà·½·¨Ö§³ÖÁ¬½Ó³ØµÄÓ÷¨¡£
¶þ¡¢Á¬½Ó³ØµÄ¹Ø¼üÎÊÌâ·ÖÎö£º
1.         ²¢·¢ÎÊÌâ
ΪÁËʹÁ¬½Ó¹ÜÀí·þÎñ¾ßÓÐ×î´óµÄͨÓÃÐÔ£¬±ØÐ뿼ÂǶàÏ̻߳·¾³£¬¼´²¢·¢ÎÊÌâ¡£Õâ¸öÎÊÌâÏà¶Ô±È½Ïº ......

java »ñȡʱ¼äÀà

 public String getCheckDateString(String str) {
        Date date = new Date();//»ñÈ¡µ±Ç°ÏµÍ³ÈÕÆÚ
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");//ʱ¼ä¸ñʽ
        Calendar cal = Calendar.getInstance();
        String CheDate = "";
        if (str.equals("½ñÌì")) {
            date.setTime(date.getTime());
            CheDate = " and s.StudyDate='" + format.format(date) + "'"; // dateFormat.format(toda) µÃµ½µÄÊǽñÌìµÄÈÕÆÚµÄStringÐÎʽ
        } else if (str.equals("×òÌì")) {
            date.setTime(date.getTime() - 24 * 60 * ......

¶¯Ì¬Éú³ÉjavaÎļþµÄ·½·¨

package com.hongsoft.test;
import java.io.*;
//¶¨ÖƵÄÀà×°ÈëÆ÷
public class TestCompile extends ClassLoader
{
String _compiler;
String _classpath;
public static void main(String[] args)
{
new TestCompile();
}
public TestCompile()
{
super(ClassLoader.getSystemClassLoader());
//ĬÈϱàÒëÆ÷
if (_compiler == null)
_compiler = "D:\\j2sdk1.4.2\\bin\\javac";
_classpath = ".";
String extraclasspath =
"c:\\Program Files\\Java\\j2re1.4.2\\lib\\rt.jar";
// = System.getProperty("calc.classpath");
if (extraclasspath != null)
{
_classpath =
_classpath
+ System.getProperty("path.separator")
+ extraclasspath;
}
compile();
}
public void compile()
{
String filename = "";
String classname = "";
try
{
//´´½¨ÁÙʱÎļþ
File javafile =
File.createTempFile("compiled_", ".java", new File("."));
filename = javafile.getName();
classname = filename.substring(0, filename.lastIndexOf("."));
generateJavaFile(javafile, classname);
......

»ùÓÚmvcµÄjava webÉè¼ÆÓ뿪·¢


µÚ1Õ strutsÓëjava webÓ¦Óüò½é
1.1 java webÓ¦ÓøÅÊö
1.2 web×é¼þµÄÈýÖÖ¹ØÁª¹Øϵ
1.3 muv¸ÅÊö
1.4 struts¸ÅÊö
1.4.1 strutsʵÏÖmvcµÄ»úÖÆ
ÔÚstruts¿ò¼ÜÖУ¬Ä£ÐÍÓÉʵÏÖÒµÎñÂß¼­µÄjavabean»òejb×é¼þ¹¹³É£¬¿ØÖÆÆ÷ÓÉ
ActionServletºÍActionÀàʵÏÖ£¬ÊÓͼÓÉÒ»×éjspÎļþ¹¹³É¡£
1.ÊÓͼ
ÊÓͼ¾ÍÊÇjspÎļþ¡£ÔÚÕâЩjspÎļþÖÐûÓÐÒµÎñÂß¼­£¬Ò²Ã»ÓÐÄ£ÐÍÐÅÏ¢£¬Ö»ÓбêÇ©¡£
ͨ³£°Ñstruts¿ò¼ÜÖеÄActionForm bean Ò²»®·Öµ½ÊÓͼģ¿éÖС£struts¿ò¼ÜÀûÓÃActionForm
beanÀ´½øÐÐÊÓͼºÍ¿ØÖÆÆ÷Ö®¼ä±íµ¥Êý¾ÝµÄ´«µÝ¡£struts¿ò¼Ü°ÑÓû§ÊäÈëµÄ±íµ¥Êý¾Ý±£´æÔÚ
ActionForm beanÖУ¬°ÑËü´«µÝ¸ø¿ØÖÆÆ÷£¬¿ØÖÆÆ÷¿ÉÒÔ¶ÔActionForm beanÖеÄÊý¾Ý½øÐÐÐ޸ģ¬
jspÎļþʹÓÃstruts±êÇ©¶ÁÈ¡Ð޸ĺóµÄActionForm beanµÄÐÅÏ¢¡£ÖØÐÂÉèÖÃhtml±íµ¥¡£
2.Ä£ÐÍ
Ä£ÐͱíʾӦÓóÌÐòµÄ״̬ºÍÒµÎñÂß¼­¡£ÒµÎñÂß¼­Í¨³£ÓÉjavabean»òejb×é¼þÀ´ÊµÏÖ¡£
3.¿ØÖÆÆ÷
¿ØÖÆÆ÷ÓÉActionServletÀàºÍActionÀàÀ´ÊµÏÖ¡£ActionServletÀàÊÇstruts¿ò¼ÜÖеĺË
ÐÄ×é¼þ¡£ActionServlet¼Ì³ÐÁËjavax.servlet.http.HttpServletÀ࣬ËüÔÚmvcÄ£ÐÍÖаçÑÝ¿ØÖÆ
Æ÷µÄ½ÇÉ«¡£ActionServletÖ÷Òª¸ºÔð½ÓÊÕhttpÇëÇóÐÅÏ¢£¬¸ù¾ÝÅäÖÃÎļþstruts-config.xmlµÄÅ ......

Java ÀûÓÃÌ×½Ó×ÖSocketʵÏÖ¼òµ¥µÄ·þÎñÆ÷Óë¿Í»§¶ËͨÐÅ

ÎÒÃÇҪʵÏֵľßÌ幦ÄÜÊÇ£º
ÀûÓÃSocketÀàºÍServerSocketÀà±àдһ¸öC/S³ÌÐò£¬ÊµÏÖC/SͨÐÅ¡£
¿Í»§¶ËÏò·þÎñÆ÷¶Ë·¢ËÍTimeÃüÁ·þÎñÆ÷¶Ë½ÓÊܵ½¸Ã×Ö·û´®ºó½«·þÎñÆ÷¶Ëµ±Ç°Ê±¼ä·µ»Ø¸ø¿Í»§¶Ë£»¿Í»§¶ËÏò·þÎñÆ÷¶Ë·¢ËÍExitÃüÁ·þÎñÆ÷¶ËÏò¿Í»§¶Ë·µ»Ø“Bye”ºóÍ˳ö¡£
ÌâÄ¿±È½Ï¼òµ¥µÄ£¬ÎÒÃÇÖ±½ÓÀ´¿´´úÂë°É£º
Ê×ÏÈÊÇ·þÎñÆ÷¶ËµÄʵÏÖ£º
 import java.net.ServerSocket;
import java.net.Socket;
import java.io.*;
import java.text.DateFormat;
import java.util.Date;//ʱ¼ä
//import java.util.Calendar;
public class Server {
public static void main(String args[]){
try{
ServerSocket server = new ServerSocket(11111);//´´½¨·þÎñÆ÷Ì×½Ó×Ö
System.out.println("·þÎñÆ÷Æô¶¯Íê±Ï");

System.out.println("µÈ´ý¿Í»§¶ËÁ¬½Ó...");
Socket socket = server.accept();//µÈ´ý¿Í»§¶ËÁ¬½Ó

BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));//»ñµÃ¿Í»§¶ËµÄÊäÈëÁ÷
//OutputStreamWriter out = new OutputStreamWriter(socket.getOutputStream());//»ñµÃ¿Í»§¶ËÊä³öÁ÷
......

java»ñµÃÍøÒ³ÄÚÈÝ

Íøַץȡ Java API ¸ÅÊö
 
http://code.google.com/intl/zh-CN/appengine/docs/java/urlfetch/usingjavanet.html
App Engine Ó¦ÓóÌÐò¿ÉÒÔÓëÆäËûÓ¦ÓóÌÐò½øÐÐͨÐÅ»òͨ¹ýץȡÍøÖ··ÃÎÊÍøÂçÉϵÄÆäËû×ÊÔ´¡£Ó¦ÓóÌÐò¿ÉÒÔʹÓÃÍøַץȡ·þÎñÀ´·¢³ö HTTP ºÍ HTTPS ÇëÇó²¢½ÓÊÕÏìÓ¦¡£³öÓÚЧÂʺÍÀ©Õ¹ÐÔ¿¼ÂÇ£¬Íøַץȡ·þÎñʹÓà Google µÄÍøÂç»ù´¡½á¹¹¡£
Óà java.net ץȡÍøÖ·
Ìá³öÇëÇó
°²È«Á¬½ÓºÍ HTTPS
ÇëÇó±êÍ·
ÏìÓ¦
ÁªÏµ¹«Ë¾·À»ðǽ֮ºóµÄÖ÷»ú
ÍøַץȡºÍ¿ª·¢·þÎñÆ÷
Åä¶îºÍÏÞÖÆ
Óà java.net ץȡÍøÖ·
Äú¿ÉÒÔʹÓà Java ±ê×¼¿âÖÐµÄ java.net.URLConnection ºÍÏà¹ØÀ࣬ͨ¹ý Java Ó¦ÓóÌÐò´´½¨ HTTP ºÍ HTTPS Á¬½Ó¡£App Engine ʹÓÃÍøַץȡ·þÎñʵÏִ˽ӿڣ»ÄúµÄÓ¦ÓóÌÐòûÓÐÖ±½Ó´´½¨Ì×½Ó×ÖÁ¬½Ó¡£
»ñȡijÍøÖ·µÄÒ³ÃæÄÚÈݵÄÒ»ÖÖ¼òµ¥·½·¨ÊÇ´´½¨ java.net.URL ¶ÔÏó£¬È»ºóµ÷ÓÃÆä openStream() ·½·¨¡£¸Ã·½·¨¿É´¦Àí´´½¨Á¬½ÓµÄÏêÇ飬·¢³ö HTTP GET ÇëÇó£¬È»ºó¼ìË÷ÏìÓ¦Êý¾Ý¡£
import java.net.MalformedURLException; 
import java.net.URL; 
import java.io.BufferedReader; 
import java.io.InputStreamReader; 
import java.io.IOException;&n ......
×ܼǼÊý:6386; ×ÜÒ³Êý:1065; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [6] [7] [8] [9] 10 [11] [12] [13] [14] [15]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ