jsp×Ô¶¨ÒåǶÌ×±êÇ©
1.¶¨Òå±êǩʵÏÖÀà
ParentTag.java
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
public class ParentTag extends TagSupport {
private static final long serialVersionUID = 1L;
private Map<String,String> map = new HashMap<String,String>();
//±êÇ©ÊôÐÔid
private String id ;
public String getId(){
return id;
}
public void setId(String id){
this.id = id;
}
//¸Ã·½·¨ÔÚ×Ó±êÇ©Öе÷Ó㬸ø¸¸±êÇ©ÖеÄmap¸³Öµ
public void addValue(String key,String value){
map.put(key,value);
}
/**
* doStartTag()·½·¨·µ»ØÒ»¸öÕûÊýÖµ£¬ÓÃÀ´¾ö¶¨³ÌÐòµÄºóÐøÁ÷³Ì¡£
*¡¡A.Tag.SKIP_BODY£º±íʾ±êÇ©Ö®¼äµÄÄÚÈݱ»ºöÂÔ
*¡¡B.Tag.EVAL_BODY_INCLUDE£º±íʾ±êÇ©Ö®¼äµÄÄÚÈݱ»Õý³£Ö´ÐÐ
*/
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
try {
Set<String> keySet = map.keySet();
Iterator<String> it = keySet.iterator();
while(it.hasNext()){
String key = it.next();
String value = map.get(key);
out.write(key +": <input type='text' name="+key+" value="+value+" /><br>");
}
} catch (IOException e) {
e.printStackTrace();
}
return EVAL_BODY_INCLUDE;
}
/**
* doEndTag£ºµ±JSPÈÝÆ÷Óöµ½×Ô¶¨Òå±êÇ©µÄ½áÊø±êÖ¾£¬¾Í»áµ÷ÓÃdoEndTag()·½·¨¡£doEndTag()·½·¨Ò²·µ»ØÒ»¸öÕûÊýÖµ£¬ÓÃÀ´¾ö¶¨³ÌÐòºóÐøÁ÷³Ì¡£
¡¡¡¡ * A.Tag.SKIP_PAGE£º±íʾÁ¢¿ÌÍ£Ö¹Ö´ÐÐÍøÒ³£¬ÍøÒ³ÉÏδ´¦ÀíµÄ¾²Ì¬ÄÚÈݺÍJSP³ÌÐò¾ù±»ºöÂÔÈκÎÒÑÓеÄÊä³öÄÚÈÝÁ¢¿Ì·µ»Øµ½¿Í»§µÄä¯ÀÀÆ÷ÉÏ¡£
¡¡¡¡ * B.Tag.EVAL_PAGE£º±íʾ°´ÕÕÕý³£µÄÁ÷³Ì¼ÌÐøÖ´ÐÐJSPÍøÒ³
*/
public int doEndTag() throws JspException {
return EVAL_PAGE;
}
}
ChildTag.java
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
public class ChildTag extends TagSupport {
private static final long
Ïà¹ØÎĵµ£º
this.state="01";ͨ³£µÄ×ö·¨ÊÇдһ¸öÀࣨ½Ó¿Ú£©À´´æ·Å³£Á¿
public interface MyConstant
{
public static final String STATE_01= "01";
}
È»ºóÔÚ³ÌÐòÖÐÕâÑùд¾Í¿ÉÒÔÁË
this.state=MyConstant.STATE_01;
ÔÚJava³ÌÐòÖÐÕâÑù¾Í¿ÉÒÔ±ÜÃâÓ²±àÂëÁË¡£¿ÉÊÇJSPÖÐÄØ£¿µ±È»£¬Èç¹ûJSPÖÐÔÊÐíʹÓÃScripletµÄ»°µ±È»Ò²¿ÉÒÔÖ±½ÓʹÓó ......
<jsp:useBean>¶¯×÷ÓÃÓÚʵÀý»¯JavaBean£¬»òÕ߶¨Î»Ò»¸öÒѾ´æÔÚµÄJavaBeanʵÀý£¬²¢°ÑʵÀýµÄÒýÓø³¸øÒ»¸ö±äÁ¿¡£
Óï·¨ÈçÏ£º
<jsp:useBean id="cart" scope="session" class="org.sunxin.lesson.jsp.bookstore.CartBean">
<jsp:setProperty>¶¯×÷ºÍ<jsp:useBean>Ò»ÆðʹÓã¬ÓÃÀ´ÉèÖÃJavaBeanµÄ¼òµ¥ÊôÐ ......
JSPµÄÔËÐлúÖÆ£º
JSPÈÝÆ÷¹ÜÀíJSPÒ³ÃæÉúÃüÖÜÆÚµÄÁ½¸ö½×¶Î£º×ª»»½×¶ÎºÍÖ´Ðн׶Ρ£µ±ÓÐÒ»¸ö¶ÔJSPÒ³ÃæµÄ¿Í»§ÇëÇóµ½À´Ê±£¬JSPÈÝÆ÷¼ìÑéJSPÒ³ÃæµÄÓï·¨ÊÇ·ñÕýÈ·£¬½«JSPÒ³Ãæת»»ÎªServletÔ´Îļþ£¬È»ºóµ÷ÓÃjavac¹¤¾ßÀà±àÒëServletÔ´ÎļþÉú³É×Ö½ÚÂëÎļþ£¬ÕâÒ»½×¶ÎÊÇת»»½×¶Î¡£½ÓÏÂÀ´£¬ServletÈÝÆ÷¼ÓÔØת»»ºóµÄServletÀ࣬ʵÀý»¯Ò»¸ ......
¡¡¡¡¸÷´óÍøÂç±à³ÌÓïÑÔµÄ10Äê·ÜÕ½£¬¸÷ÓÐËù³¤¡¢¸÷ÁìǧÇï¡£½ñÈÕ¶ÔÓÚÎÒÃǵÄÍøÕ¾±à³ÌÓïÑÔ:ASP¡¢JSP¡¢PHP¡¢ASP.NET½øÐÐʵ¼ÊÓ¦ÓÃͳ¼Æ:
¡¡¡¡ASP:50%
¡¡¡¡JSP:10%
¡¡¡¡PHP:20%
¡¡¡¡ASP.NET:20%
¡¡¡¡¸ù¾ÝÒÔÉÏͳ¼ÆÀ´×öÒ»ÏÂÌÖÂÛ¡£ASP¼¼ÊõÈç½ñÌì¿ÉÒÔ˵ÒѳÉΪ¹ýÈ¥£¬µ«ÈÔÕ¼Êг¡µÄ50%£¬ÒòΪµ±Ê±ASP¼¼ÊõµÄÐËÆ𣬶Դ󲿷ֱà³Ì ......
1. ÈçºÎÈÃÑ¡ÖеÄÒ»ÐмǼ¸ßÁÁÏÔʾ£¿
http://topic.csdn.net/t/20050105/09/3699823.html
2. ÈçºÎÔÚÏÂÀÁбí¿òÀïÑ¡ÔñÒ»¸öÖµºóÌø³öд°¿Ú?
http://topic.csdn.net/t/20050107/15/3707444.html
3. ÈçºÎÔÚJSPÖÐÆô¶¯execl?
http://community.csdn.net/Expert/TopicView1.asp?id=4909154
http://community.csdn.net/Expert/ ......