锘??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美一区二区三区在线播放,亚洲91精品在线观看,亚洲va欧美va天堂v国产综合http://www.aygfsteel.com/redish/category/12762.html鎴戣兘錛屾墍浠ユ垜鍦?/description>zh-cnTue, 27 Feb 2007 08:40:11 GMTTue, 27 Feb 2007 08:40:11 GMT60- Struts 涓殑銆html:options(鎽樻妱)http://www.aygfsteel.com/redish/archive/2006/07/09/57304.htmlRedishRedishSat, 08 Jul 2006 16:58:00 GMThttp://www.aygfsteel.com/redish/archive/2006/07/09/57304.htmlhttp://www.aygfsteel.com/redish/comments/57304.htmlhttp://www.aygfsteel.com/redish/archive/2006/07/09/57304.html#Feedback1http://www.aygfsteel.com/redish/comments/commentRss/57304.htmlhttp://www.aygfsteel.com/redish/services/trackbacks/57304.html銆銆
銆銆闇姹傦紝瑕佽揪鍒幫細(xì)
銆銆<select name="beanCollectionSelect" multiple="multiple" size="10">
銆銆<option value="value 0">Label 0</option>
銆銆<option value="value 1" selected="selected">Label 1</option>
銆銆<option value="value 2">Label 2</option>
銆銆<option value="value 3" selected="selected">Label 3</option>
銆銆<option value="value 4">Label 4</option>
銆銆<option value="value 5" selected="selected">Label 5</option>
銆銆<option value="value 6">Label 6</option>
銆銆<option value="value 7">Label 7</option>
銆銆<option value="value 8">Label 8</option>
銆銆<option value="value 9">Label 9</option></select>
銆銆
銆銆瑕佸疄鐜頒笂榪版晥鏋滐紝闇瑕佷袱姝ワ細(xì)
銆銆絎竴錛氳緗瓵ctionForm錛?br />銆銆涔熷垎涓ゅ皬姝ワ細(xì)絎竴灝忔蹇呴』鍦ˋctionForm涓紝鏈変竴鍙?br />銆銆private Collection beanCollection;
銆銆public Collection getBeanCollection();
銆銆
銆銆Collection beanCollection瑕佺‘淇濇槸涓涓疄鐜幫紝濡侫rrayList錛屽鏋滀笉鏄垯浼?xì)鎶o collection found鐨勯敊璇紝Struts鐨勬渶澶т笉鏂逛究灝辨槸涓鏃﹀嚭闂錛屽畾浣嶅緢闅撅紝涓嶇煡閬撲粈涔堝湴鏂逛嬌鐢ㄩ敊璇紝鎴栧繕璁拌緗粈涔堜簡銆?br />銆銆
銆銆鍥犱負(fù)鍓嶉潰闇姹備腑option鐨剉alue鍊煎拰label鍊間笉涓鏍鳳紝閭d箞鍦╞eanCollection涓繚瀛樼殑灝辨槸涓涓獀alue鍜宭abel緇勬垚鐨勫璞★紝鍚嶄負(fù)LabelvalueBean錛屽湪LabelvalueBean涓湁涓や釜灞炴alue鍜宭abel錛?br />銆銆
銆銆鍦ㄧ▼搴忔煇涓湴鏂硅涓篵eanCollection璧嬪鹼紝濡傦細(xì)
銆銆
銆銆Vector entries = new Vector(10);銆
銆銆entries.add(new LabelvalueBean("Label 0", "value 0"));銆銆銆銆銆
銆銆entries.add(new LabelvalueBean("Label 1", "value 1"));銆銆銆銆銆
銆銆entries.add(new LabelvalueBean("Label 2", "value 2"));銆銆銆銆銆
銆銆entries.add(new LabelvalueBean("Label 3", "value 3"));銆銆銆銆銆
銆銆entries.add(new LabelvalueBean("Label 4", "value 4"));銆銆銆銆銆銆
銆銆entries.add(new LabelvalueBean("Label 5", "value 5"));銆銆銆銆銆
銆銆 entries.add(new LabelvalueBean("Label 6", "value 6"));銆銆銆銆銆銆
銆銆entries.add(new LabelvalueBean("Label 7", "value 7"));銆銆銆銆銆銆
銆銆entries.add(new LabelvalueBean("Label 8", "value 8"));銆銆銆銆銆銆
銆銆entries.add(new LabelvalueBean("Label 9", "value 9"));
銆銆
銆銆鐒跺悗鎵цsetBeanCollection(entries);
銆銆榪欐牱ActionForm涓殑beanCollection綆楁湁鍊間簡銆?br />銆銆絎簩灝忔錛岄渶瑕佽緗甋elected錛宻elected鏈変袱縐嶏紝鍗曢夊拰澶氶夛細(xì)
銆銆鍦ˋctionForm涓繀欏繪湁錛?br />銆銆
銆銆private String singleSelect = "Single 5";銆
銆銆public String getSingleSelect()
銆銆 {
銆銆銆銆銆return (this.singleSelect);
銆銆銆銆}銆
銆銆public void setSingleSelect(String singleSelect)
銆銆 {
銆銆銆銆銆this.singleSelect = singleSelect;
銆銆銆銆}
銆銆
銆銆鎴栧閫夛紝澶氶夊繀欏繪槸鏁扮粍錛?br />銆銆
銆銆private String[] beanCollectionSelect = { "value 1", "value 3",
銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆銆"value 5" };銆
銆銆public String[] getBeanCollectionSelect() {
銆銆銆 return (this.beanCollectionSelect);銆銆}
銆銆銆銆public void setBeanCollectionSelect(String beanCollectionSelect[])
銆銆 {
銆銆銆銆銆銆this.beanCollectionSelect = beanCollectionSelect;
銆銆銆銆}
銆銆
銆銆絎簩錛氬湪Jsp涓啓鍏ang lib璇彞濡備笅錛?br />銆銆
銆銆<html:select property="beanCollectionSelect" size="10" multiple="true">
銆銆銆銆銆銆<html:optionsCollection name="testbean" property="beanCollection"/>銆銆
銆銆 </html:select>
銆銆
銆銆鍏朵腑testbean鏄疉ctionForm鐨勫悕縐般?br />銆銆
銆銆浠ヤ笂鏄痟tml:options鐨凜ollection瑙e喅鏂規(guī)錛屽鏋渙ption鍊煎緢灝戯紝綆鍗曞湴鍙互瀹炵幇涓烘暟緇勶紝涓ゆ錛?br />銆銆絎竴錛氬湪ActionForm涓紝
銆銆
銆銆private String values[] =
銆銆銆銆 { "Magazine", "Journal", "News Paper","Other" };銆
銆銆private String labels[] =
銆銆銆銆 { "L-Magazine", "L-Journal", "L-News Paper","L-Other"};
銆銆銆銆private String selected = "Magazine";銆銆
銆銆public String getSelected()
銆銆{
銆銆銆銆銆return selected;
銆銆銆銆}銆銆
銆銆public void setSelected(String selected)
銆銆{
銆銆銆銆銆this.selected = selected;
銆銆銆銆}銆
銆銆public String[] getvalues()
銆銆{
銆銆銆銆銆return values;
銆銆銆銆}銆銆
銆銆public void setvalues(String[] values)
銆銆{銆銆銆this.values = values;
銆銆銆銆}銆
銆銆public String[] getLabels()
銆銆{
銆銆銆銆銆return values;
銆銆銆銆}銆銆
銆銆public void setLabels(String[] labels)
銆銆{
銆銆銆銆銆this.labels = labels;
銆銆銆銆}
銆銆
銆銆絎簩姝ュ湪jsp涓細(xì)
銆銆
銆銆<html:select property="selected" >銆銆銆銆銆
銆銆<html:options name="testbean" property="values" labelProperty="label"/>銆銆銆</html:select>
銆銆
銆銆Struts鏍囩搴撶殑浣跨敤榪樻槸闇瑕佸皬蹇冿紝涓嶅繀瀹屽叏浣跨敤Struts鐨勬爣絳懼簱錛屼釜浜烘劅瑙塖truts榪欑鏇夸唬Html璇彞鐨勬爣絳懼簱鏈変竴縐嶇壍寮洪檮浼?xì)锛尵l欎嬌鐢ㄨ呮帉鎻″甫鏉ラ毦搴︼紝浣跨敤鑰呴櫎鐔熸?zhèn)塰tml澶栵紝榪樺繀欏葷悊瑙truts鐨勫搴旀爣絳懼簱鐢ㄦ硶錛岃屼笖榪欑璋冭瘯鍑洪敊錛岄棶棰樹篃鏃犳硶鍑嗙‘瀹氫綅錛屾繪槸鎶借薄鍦板憡璇変綘錛宯o bean 鎴杗o form 
]]>
主站蜘蛛池模板:
大余县|
黎平县|
高青县|
太保市|
高碑店市|
伊通|
南岸区|
尼勒克县|
香格里拉县|
德钦县|
通榆县|
潍坊市|
永善县|
常山县|
滨海县|
合肥市|
慈溪市|
萝北县|
东山县|
虹口区|
光泽县|
忻州市|
和顺县|
沙河市|
大新县|
武冈市|
当涂县|
卓尼县|
兴文县|
镇赉县|
武功县|
南安市|
永寿县|
江源县|
宁远县|
屏东市|
德清县|
宁津县|
当阳市|
河津市|
巢湖市|