java×Ô¶¨Òå±êÇ©
Èý²½£º
Ò»¡¢×Ô¶¨Òå±êǩʵÏÖÀࣺ myTags.java;
¶þ¡¢×Ô¶¨Òå±êÇ©¿âÎļþ£¨TLD£©: myTags.tld;
Èý¡¢Ò»¸öJSPÒ³Ã棺Ëæ±ãдÁË;
Ê×ÏÈmyTags.java
package com.tags;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
public class myTags extends TagSupport {
public String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int doEndTag() throws JspException {
JspWriter out = pageContext.getOut();//µÃµ½out
try{
out.println("<table bgColor=yellow>");
out.println("<tr>");
out.println("<td>"+ name +" : this is myTags!!</td>");
out.println("</tr>");
out.println("</table>");
}catch(Exception ex){ex.printStackTrace();}
return this.EVAL_PAGE;
}
}
È»ºómyTags.tldÎļþ£¬ÔÚweb-infÎļþ¼ÐÏÂÉú³É£¬Ò²¿É¿´×öÒ»¸öXMLÎļþ
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib> <!-- ±êÇ©¿â¶¨ÒåÎļþ¸ù½Úµã:taglib -->
<tlibversion>1.2</tlibversion> <!-- ±êÇ©¿â°æ±¾ -->
<jspversion>1.1</jspversion> <!-- Jsp°æ±¾ -->
<shortname>mytags</shortname> <!-- ±êÇ©¿âÃû³Æ -->
<uri>mytags</uri> <!-- uri:ºÜÖØÒª£¡Íâ½çµ¼Èë±êÇ©¿âʱÈÏʶµÄÃû³Æ -->
<!-- ¶¨Òå±êÇ© -->
<tag>
<name>showTable</name> <!-- ±êÇ©Ãû³Æ -->
<tagclass>com.tags.myTags</tagclass> <!-- ¶ÔÓ¦µÄÀà -->
<attribute>
<name>name</name>
<required>true</required> <!-- ÊÇ·ñ±ØÐè -->
<rtexprvalue>true</rtexprvalue> <!-- ÄÜ·ñ½ÓÊܱí´ïʽ -->
</attribute>
</tag>
</taglib>
×îºó£¬À´Ò»¸öÒ³Ãæ°É
<%@
Ïà¹ØÎĵµ£º
½ñÌì¼ÌÐøѧϰjavaºÍandroidƽ̨ javaµÄѧϰËãÊDz¹³ä£¬ÒòΪûÓÐjava»ù´¡Ò²×ö²»³öʲô¶«Î÷À´
½ñÌì¿´µ½javaÓÃthis¹Ø¼ü×ÖÀ´ÖØÔع¹Ôì·½·¨£¬ÔÚÕâÀï×ö¸ö±Ê¼Çclass a_sample{
public int x,y.z;
a_sample(int x){
this.x=x;
}
a_sample(int x,int y){
this(x);
this.y=y;
}
a_sample(int x ......
annotations : ×¢ÊÍ
ºÃ´¦
1.Îĵµ±àÖÆ
2.±àÒëÆ÷¼ì²é
3.´úÂë·ÖÎö
JSR 175 ÊDZà³ÌÓïÑÔµÄÔªÊý¾Ý¹¤¾ß,Ϊ½«ÔªÊý¾ÝºÏ²¢µ½ºËÐÄjavaÓïÑÔÖÐÌṩÕýʽÀíÓɺÍ˵Ã÷
»ù±¾ÖªÊ¶:
×¢ÊͲÉÓÃ"@"±ê¼ÇÐÎʽ,ºóÃæÊÇ×¢ÊÍÃû³Æ,È»ºóÔÚÐèÒªÊý¾Ýʱ,ͨ¹ýname=value¶ÔÏò×¢ÊÍÌṩÊý¾Ý
×¢Ê͵ÄÈý¸ö»ù±¾ÖÖÀà:
±ê¼Ç×¢ÊÍ ......
×î½ü¹«Ë¾Òª¿ª·¢Windowsƽ̨ÉϵIJúÆ·£¨ÓÉÓÚÉæ¼°µ½ÉÌÒµ»úÃÜ£¬ËùÒÔÄ¿Ç°ÎÞ·¨¶ÔÕâ¸ö²úÆ·×öÏêϸ½éÉÜ£©£¬²ÉÓÃ.Net¼¼Êõ½øÐпª·¢£¬ÎÒ¸ºÔðµÄÊÇ»ùÓÚ Visual Studio²å¼þ»úÖƵÄÐÐÒµ¿ª·¢¹¤¾ßµÄ¿ª·¢¡£´Ó¿ªÊ¼½Ó´¥.Netµ½ÏÖÔÚÒѾÓнüÈý¸öÔÂÁË£¬¶øÇÒÒ²¿ª·¢³öÁ˵ÚÒ»¸ö°æ±¾£¬¶Ô.NetÒѾÓÐÁËһЩÈÏʶ£¬ÓÉÓÚÒÔÇ°Ö÷ÒªÓÃJava¡¢PythonµÈÓïÑ ......
´Ójdk1.5¿ªÊ¼£¬JavaÖпªÊ¼Ö§³Ö·¶ÐÍÁË¡£·¶ÐÍÊÇÒ»¸öºÜÓÐÓõıà³Ì¹¤¾ß£¬¸øÎÒÃÇ´øÀ´Á˼«´óµÄÁé»îÐÔ¡£ÔÚ¿´ÁË¡¶javaºËÐıà³Ì¡·Ö®ºó£¬ÎÒСÓÐÊÕ»ñ£¬Ð´³öÀ´Óë´ó¼Ò·ÖÏí¡£
Ëùν·¶ÐÍ£¬Îҵĸоõ¾ÍÊÇ£¬²»Óÿ¼ÂǶÔÏóµÄ¾ßÌåÀàÐÍ£¬¾Í¿ÉÒÔ¶Ô¶ÔÏó½øÐÐÒ»¶¨µÄ²Ù×÷£¬¶ÔÈκζÔÏó¶¼Ä ......
1¡¢¶ÔÏóÊÇ°´ÒýÓô«µÝµÄ---´ø"="ºÅµÄ¸³Öµ²Ù×÷
2¡¢Java Ó¦ÓóÌÐòÓÐÇÒ½öÓеÄÒ»ÖÖ²ÎÊý´«µÝ»úÖÆ£¬¼´°´Öµ´«µÝ---ÓÉ"º¯Êýµ÷ÓÃ"ÒýÆðµÄ
3¡¢°´Öµ´«µÝÒâζ×ŵ±½«Ò»¸ö²ÎÊý´«µÝ¸øÒ»¸öº¯Êýʱ£¬º¯Êý½ÓÊÕµÄÊÇÔʼֵµÄÒ»¸ö¸±±¾
4¡¢°´ÒýÓô«µÝÒâζ×ŵ±½«Ò»¸ö²ÎÊý´«µÝ¸øÒ»¸öº¯Êýʱ£¬º¯Êý½ÓÊÕµÄÊÇÔʼֵµÄÄÚ´æµØÖ·£¬¶ø²»ÊÇÖµ µÄ¸±±¾
5¡¢×¢ ......