ÔÚJSPÒ³ÃæÖÐÓÃselectÏÂÀÁбíÀ´ÏÔʾListÁбíµÄ·½Ê½
Ò» ¡¢ ÓÃstruts2±êÇ©µÄ<s:selectÀ´ÏÔʾ
<s:select cssStyle="width: 84%" list="#application.officeList" headerKey="" headerValue="--ÇëÑ¡Ôñ--" listKey="#this.value" listValue="#this.key+'.'+#this.value" name="entity.officeName" value="entity.officeName"/>
ÆäÖÐ
1¡¢listÊǽÓÊÕjavaÀà»òÕßÔÚÆô¶¯Ê±¾ÍÒѾ¼ÓÔصÄapplicationÖеÄlistÁбíÖµ £»
2¡¢listKeyµÄÖµÊÇselectµÄÖµ£»
3¡¢listValueµÄÖµÊÇÏ൱ÓÚ<selectÖÐÏÔʾ³öÀ´µÄtext£»
4¡¢valueÊÇjavaÀàÖд«À´µÄÖµ£¬ÓÃÀ´ÓëselectÁбíÖеÄoptionµÄidÖµ×ö¶Ô±È
¶þ ¡¢ÓÃ<select À´ÏÔʾ´ÓjavaÀà¶Ë´«¹ýÀ´µÄListÁбíÖеÄÑ¡Ïî
<select name="entity.officeName">
<option value="">--ÇëÑ¡Ôñ--</option>
<s:iterator value="#application.officeList" id="bean">
<option value="${bean.value}" <s:if test='#bean.key==entity.officeName'>selected</s:if> >${bean.key}.${bean.value}</option>
</s:iterator>
</select>
Ïà¹ØÎĵµ£º
JSPͬÑùÊÇʵÏÖ¶¯Ì¬ÍøÒ³µÄÒ»¸öÀûÆ÷¡£ÓÉÓÚËûµÄ½Å±¾ÓïÑÔÊÇJAVA£¬ËùÒԼ̳ÐÁËJAVAÖî¶àÓŵ㡣ÄÇôÓëASPÏà±È£¬Ó¦¸Ã¿ÉÒÔ˵ASPºÍJSP»ù±¾²»ÊÇÒ»¸öµµ´ÎÉϵġ£ÄÇôASP.NETºÍJAVAÈ´ÊÇ¿ÉÒÔ¿¹ºâµÄ¡£
JSPºÍASPÏà±È½Ï£º ÔËÐÐËٶȡ¢ÔËÐпªÏú¡¢ÔËÐÐƽ̨¡¢À©Õ¹ÐÔ¡¢°²È«ÐÔ¡¢º¯ÊýÖ§³Ö¡¢³§ÉÌÖ§³Ö¡¢¶ÔXMLµÄÖ§³ÖµÈµÈ£¬ASP¶¼²»ÊÇJSPµÄ¶ÔÊÖ¡£COM ......
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> ......
JSPÔà»°¹ýÂËÆ÷µÄʵÏÖ
²»¹ÜÊÇJSP»¹ÊÇServlet£¬ÆäFilter¹ýÂËÆ÷¶¼ÊÇÒ»¸ö¶«Î÷¡£ÒòΪJSPµÄ±¾ÖʾÍÊÇServlet£¬Ö»²»¹ýÊDZ»°ü×°ÁËһϣ¬³ÉÁ˱ê×¼£¬ÈÃWeb·þÎñÆ÷¶¼×ñÑÕâ¸ö±ê×¼À´½âÎö±àÒëÖ´ÐжøÒÑ¡£
ÒÔÏÂÑÝʾµÄ¾ÍÊÇÔÚJSPÖÐÈçºÎ¹ýÂËÔà»°£¨ServletµÄ´¦Àí·½Ê½Ò²²î²»¶à£©¡£
Ò»¡¢¹ýÂËÆ÷Àà
package com.filter;
import java.io.Buffere ......
ÒѾ×öºÃµÄÒ»¸öJ2EEÏîÄ¿£¬ÏëÓ¦ÓÃflexÖеÄͼ±í£¬ËùÒÔÏÖÔÚµÄÊ×ÒªÎÊÌâ¾ÍÊÇÈçºÎ°ÑflexǶÈëµ½jspÖУ¬°´ÕÕÍøÉϽéÉܵĽâ¾ö·½°¸×öÁ˸öС²âÊÔ£º
<%@ taglib uri="FlexTagLib" prefix="mm"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
&nbs ......
¸÷ÀàÍøÒ³µ¯´°´úÂë±àд
¡¡
¾³£ÉÏÍøµÄÅóÓÑ¿ÉÄܻᵽ¹ýÕâÑùһЩÍøÕ¾£¬Ò»½øÈëÊ×Ò³Á¢¿Ì»áµ¯³öÒ»¸ö´°¿Ú£¬»òÕß°´Ò»¸öÁ¬½Ó»ò°´Å¥µ¯³ö£¬Í¨³£ÔÚÕâ¸ö´°¿ÚÀï»áÏÔʾһЩעÒâÊÂÏî¡¢°æȨÐÅÏ¢¡¢¾¯
¸æ¡¢»¶Ó¹â¹ËÖ®ÀàµÄ»°»òÕß×÷ÕßÏëÒªÌرðÌáʾµÄÐÅÏ¢¡£ÆäʵÖÆ×÷ÕâÑùµÄÒ³ÃæЧ¹û·Ç³£µÄÈÝÒ×£¬Ö»ÒªÍù¸ÃÒ³ÃæµÄHTMLÀï¼ÓÈ뼸¶ÎJavascript´úÂë¼´¿ÉÊ ......