java web±ê¼Ç¼¼Êõ
1 jsp »ù´¡¸ÅÄî
jspÊÇÔÚ´«Í³µÄhtmlÒ³ÃæÖУ¬¼ÓÈëjavaµÄ³ÌÐòƬ¶ÎºÍjsp±ê¼Ç£¬¾Í¹¹³ÉÁËjspÒ³Ãæ¡£µ±web·þÎñÆ÷Óöµ½¶ÔjspµÄ·ÃÎÊÇëÇóʱ£¬ÏÈÖ´ÐÐ¶ÔÆäÖеÄjava³ÌÐòƬ¶Î£¬È»ºóÒÔhtmlµÄ¸ñʽ·µ»Ø¸øÓû§¡£ java³ÌÐòƬ¶Î¿ÉÒÔÓÃÀ´²Ù×÷Êý¾Ý¿â£¬Öض¨ÏòÍøÒ³£¬»òÕßÊÇ·¢ËÍE-mail ,ÑéÖ¤µÇ½ÐÅÏ¢£¬ ÕâЩ²Ù×÷¶¼ÊÇÔÚ·þÎñÆ÷¶ËÍê³É£¬Óû§½ö½öÊǵõ½ÔËÐкóµÄ½á¹û¡£
¿ÉÒÔÏëÏó£¬jspÆäʵ¾ÍÊÇServletµÄÁíÒ»ÖÖÐÎʽ£¬µ±jspÒýÇæ¶ÔJspÒ³Ãæ½øÐнâÎöºó»áÉú³ÉÒ»¸öÀàËÆServletµÄÎļþ£¬È»ºó½»ÓÉServletÒýÇæ±àÒëÖ´ÐС£
Ò²¾ÍÊÇ˵ jsp ºÍServletÔÚ±àÒëºóÔÚ·þÎñÆ÷ÖеÄÐÎʽÊÇÒ»Öµġ£
2 ±ê¼Ç¿â¼¼Êõ
²úÉúµÄÔÒò£º
£¨1£© java³ÌÐòÔ±ºÍÒ³ÃæÃÀ¹¤ÈËÔ±±ØÐëͬʱ¹¤×÷¡£ÕâÊǸöºÜ´óµÄȱµã¡£
web³ÌÐòÔ±ÔÚºǫ́Éè¼Æ¸÷ÖÖ±ê¼Ç£¬¶øÒ³ÃæÉè¼ÆÈËÔ±ÔòÖ±½ÓʹÓóÌÐòÔ±Éè¼ÆºÃµÄ±ê¼Ç½øÐд¦ÀíÒ³Ãæ¡£
£¨2£©Ê×Ïȱàд<hello:sayhello>µÄjavaʵÏÖ£¬ÈçÏ£º
package servletPackage;
import java.io.IOException;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
public class HelloTag implements Tag {
//¶¨ÒåÒ³ÃæµÄÉÏÏÂÎÄ
private PageContext context = null ;
//ʵÏÖtag½Ó¿Ú
public void setPageContext(PageContext pageContext){
this.context = pageContext ;
}
//ʵÏÖTag½Ó¿Ú
public void setParent(Tag tag){
}
public Tag getParent(){
return null ;
}
//ʵÏÖTag ½Ó¿Ú£¬²¢Ö´ÐÐ±í¼¯Ìå
public int doStartTag(){
try {
context.getOut().print("Hello from Tag") ;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return SKIP_BODY ;
}
public HelloTag() {
super();
}
public int doEndTag() throws JspException {
// TODO Auto-generated method stub
return SKIP_PAGE;
}
public void release() {
// TODO Auto-generated method stub
}
}
£¨3£© È»ºóÔÙWEB-INFÎļþ¼Ðϱàдһ¸öºó׺Ϊ.tldµÄxmlÎļþ£¬ÓÃÒÔÉùÃû×Ô¶¨ÒåµÄ±êÇ©¡£
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsys
Ïà¹ØÎĵµ£º
ÕâÊÇÒ»¸öJava°æµÄÊÀ½çʱÖÓʾÀý£¬ÒÆÖ²×ÔGerrit´´½¨µÄͬÃûSwingÓ¦Óã¨http://www.jug-muenster.de/swing-worldclock-427
£©£¬ÐèÒªÔËÐÐÔÚJRE1.5»òÒÔÉÏ»·¾³µ±ÖС£
ÒÆÖ²´ËʾÀýÖ÷ÒªÊÇÒòΪǰһÕóÒÆÖ²¹ýGerritµÄswingÔ×ÓÖÓʾÀý£¬ËùνºÃʳÉË«£¬Õâ¸öÊÀ½çʱÖÓµÄʾÀý×ÔÈ»²»ÄܷŹý£¨»°ËµGerritΪʲôÄÇôϲ»¶×öʱÖÓ£¿…&hellip ......
java½Ó¿ÚʵÀý
2009-03-10 09:00:18.0 À´Ô´:ÖйúJAVA¼¼ÊõÍø
¹Ø¼ü´Ê£º java ½Ó¿Ú Âë
½üÈÕÔÚ±à³ÌÖÐÓõ½½Ó¿Ú֪ʶ,ÓÉÓڿα¾ÖжԽӿÚÃèÊö½ÏÉÙ,ËùÒÔÏë´ÓÍøÉϲéÕÒ×ÊÁÏ,µ«ÍøÉϵÄ×ÊÁÏ´ó¶àÒ²Ö»ÊÇÈß³¤µÄÃèÊö,ËùÒÔÔ ......
¹Ø¼ü×Ö: java¶àÏß³ÌÀý×Ó
µ½ÕâÀïÎÒÃÇ×öÒ»¸öÍêÕûµÄÀý×ÓÀ´ËµÃ÷Ï̲߳úÉúµÄ·½Ê½²»Í¬¶øÉú³ÉµÄÏ̵߳ÄÇø±ð£º
package debug;
import java.io.*;
import java.lang.Thread;
class MyThread extends Thread{
public int x = 0;
public void run(){
System.out.println(++x);
}
}
class R implements Runnable{ ......
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
public class TestDesktop {
public static void main(String[] a) {
try {
Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
desktop.open(new File("/hom ......