本站首页    管理页面    写新日志    退出

The Neurotic Fishbowl

[J2EE]struts 中实现options select
snowrose 发表于 2006/6/28 9:02:36

昨天看到select 的option 居然还有好多属性没有见过,不知道这些高手从哪里看到的这些东西,现总结如下:     struts 中实现options select 一个按扭增加一条信息 一个按扭删除一个和多个信息的功能 一个按扭删除所有的信息 ---------下面是完整代码---------- jsp中的内容===================== <html:form action="/createnodeAction.do" method="POST">       <html:select property="arraynode" multiple="true">         <html:optionsCollection            name="createnodeActionForm"            property="nodeCollection"            value="value"            label="label"/>               </html:select>       <html:text property="newnode"/>       <html:submit property="submit" value="add"/>       <html:submit property="submit" value="deleteselect"/>       <html:submit property="submit" value="deleteall"/>  </html:form> form中的内容==========================  ArrayList entries;     public createnodeActionForm() {         entries = new ArrayList();                 this.setNodeCollection(entries);     }     public void addEntries(String label, String value) {         entries.add(new LabelValueBean(label, value));     }          public void removeEntries(String delstr[]) {         if (entries.size() > 0) {             for (int j = 0; j < delstr.length; j++) {                 for (int i = 0; i < entries.size(); i++) {                     LabelValueBean lvb = (LabelValueBean) entries.get(i);                     if (lvb.getValue().trim().equals(delstr[j])) {                         entries.remove(i);                         break;                     }                 }             }         }          }     public void removeAllEntries() {         entries.clear();     }     public int numberofNode(){                 return   entries.size();     }     private String arraynode[];     private String newnode;     private Collection nodeCollection;     private String submit;        public void setSubmit(String submit) {         this.submit = submit;     }     public String getSubmit() {         return this.submit;     }     public Collection getNodeCollection() {         return this.nodeCollection;     }     public void setNodeCollection(Collection nodeCollection) {         this.nodeCollection = nodeCollection;     }     public String[] getArraynode() {         return arraynode;     }     public void setArraynode(String arraynode[]) {         this.arraynode = arraynode;     }     public void setNewnode(String newnode) {         this.newnode = newnode;     }     public String getNewnode() {         return newnode;     } } action中的内容==========================         createnodeActionForm createnodeActionForm = (createnodeActionForm)                 actionForm;         String submit = createnodeActionForm.getSubmit().trim();         if(submit.equals("add")){             int size = createnodeActionForm.numberofNode()+1;             createnodeActionForm.addEntries(createnodeActionForm.getNewnode().trim(),""+size);         }else if(submit.equals("deleteselect")){             String arraynode []= createnodeActionForm.getArraynode();             if(arraynode  != null){                 createnodeActionForm.removeEntries(arraynode);             }                     }else if(submit.equals("deleteall")){             createnodeActionForm.removeAllEntries();         }         return actionMapping.findForward("createnode");     }

阅读全文(2306) | 回复(0) | 编辑 | 精华

 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)

 
 



The Neurotic Fishbowl

.: 公告




Bloginess

«November 2025»
1
2345678
9101112131415
16171819202122
23242526272829
30

.: 我的分类(专题)

首页(130)
RIA(22)
linux(3)
J2EE(24)
the mood of everyday(58)
oral English(14)
database(2)
soap(3)
java(9)
web developer center(14)


In the Bowl

.: 最新日志

倾情奉献iphone、ipod、ipho
check ipad's rotatio
css position fixed d
field validation whe
常见浏览器cookie个数和大小限制说明
人类无法抗拒的10种心理,学会它,就能控
读as3cookbook 有感
flex builder linux s
Component returned f
use tramp in emacs i


.: 最新回复

replcica watches
replcica watches
Dell spikes game sit
回复:人类无法抗拒的10种心理,学会它,
回复:人类无法抗拒的10种心理,学会它,
回复:flex builder linu
回复:人类无法抗拒的10种心理,学会它,
回复:人类无法抗拒的10种心理,学会它,
回复:致女人------摘自读者
回复:虚心接受别人的意见,谨慎改正


The Fishkeeper
blog名称:up forever
日志总数:130
评论数量:274
留言数量:4
访问次数:1954285
建立时间:2006年5月25日



Text Me

.: 留言板

签写新留言

参观
这个界面很漂亮!
我试试吧
up forever
该换了!


Other Fish in the Sea

.: 链接


http://blogger.org.cn/blog/more.asp?name=hongrui&id=16955

邢红瑞 

http://niegc.cublog.cn/  聂国聪

http://www.blogjava.net/SteelHand/ 铁手剑谱

http://blog.sina.com.cn/qianqq 糖qq

http://blog.csdn.net/misty_wish   师弟

http://www.bbxy.net/xiaoyu/ Goteet老师

http://www.chinaitpower.com    中国it动力

http://jinyuxi.blog.sohu.com/ 靳羽西




lvetica, sans-serif; MARGIN: 0px 0px 8px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px } DIV.blogrollmain { FONT: 12px verdana, arial, helvetica, sans-serif } BLOCKQUOTE { COLOR: #202020; FONT: 11px verdana, arial, helvetica, sans-serif } .tinyfont { FONT: 9px verdana, arial, helvetica, sans-serif } TD { COLOR: #202020; FONT-FAMILY: verdana; FONT-SIZE: 12px } .title { COLOR: #996897; FONT-FAMILY: verdana, sans-serif; FONT-SIZE: 10pt; FONT-WEIGHT: bold } .titlefont { COLOR: #996897; FONT-FAMILY: verdana, sans-serif; FONT-SIZE: 14px; FONT-STYLE: italic } .titlefontarch { BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid; BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; COLOR: #996897; FONT-FAMILY: verdana, sans-serif; FONT-SIZE: 14px; TEXT-ALIGN: center; WIDTH: 100% } .menu_text { COLOR: #c1ae94; FONT-FAMILY: Verdana, Arial, sans-serif; FONT-SIZE: 10px; MARGIN-BOTTOM: 1px } .links { FONT-FAMILY: Verdana, Arial, sans-serif; FONT-SIZE: 11px } .smallfont { COLOR: #202020; FONT-FAMILY: Verdana, Arial, sans-serif; FONT-SIZE: 11px; MARGIN: 0px } A:link { COLOR: #996897; TEXT-DECORATION: none } A:visited { COLOR: #996897; TEXT-DECORATION: none } A:hover { BACKGROUND-COLOR: #996897; COLOR: #610862; TEXT-DECORATION: underline } A { TEXT-DECORATION: none } .content { WIDTH: auto } .dateheader { MARGIN: 0px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px; POSITION: relative; WIDTH: auto; Z-INDEX: 3; min-width: 120px } .wbtn1 { BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: #996897 1px solid; BORDER-LEFT: #996897 1px solid; BORDER-RIGHT: #996897 1px solid; BORDER-TOP: #996897 1px solid; COLOR: #996897; FONT-FAMILY: verdana, arial geneva; FONT-SIZE: 7pt; TEXT-DECORATION: none } .calendar { PADDING-BOTTOM: 4px; PADDING-LEFT: 4px; PADDING-RIGHT: 4px; PADDING-TOP: 4px; TEXT-ALIGN: center } .calhead { BACKGROUND-COLOR: #ffffff; BORDER-BOTTOM: gray 1px solid; COLOR: black; TEXT-ALIGN: center; VERTICAL-ALIGN: middle; WIDTH: 14% } .calbody { BORDER-BOTTOM: 1px solid; TEXT-ALIGN: center; VERTICAL-ALIGN: middle; WIDTH: 14% } .style2 {color: #996897}
本站首页    管理页面    写新日志    退出

The Neurotic Fishbowl

[J2EE]struts 中实现options select
snowrose 发表于 2006/6/28 9:02:36

昨天看到select 的option 居然还有好多属性没有见过,不知道这些高手从哪里看到的这些东西,现总结如下:     struts 中实现options select 一个按扭增加一条信息 一个按扭删除一个和多个信息的功能 一个按扭删除所有的信息 ---------下面是完整代码---------- jsp中的内容===================== <html:form action="/createnodeAction.do" method="POST">       <html:select property="arraynode" multiple="true">         <html:optionsCollection            name="createnodeActionForm"            property="nodeCollection"            value="value"            label="label"/>               </html:select>       <html:text property="newnode"/>       <html:submit property="submit" value="add"/>       <html:submit property="submit" value="deleteselect"/>       <html:submit property="submit" value="deleteall"/>  </html:form> form中的内容==========================  ArrayList entries;     public createnodeActionForm() {         entries = new ArrayList();                 this.setNodeCollection(entries);     }     public void addEntries(String label, String value) {         entries.add(new LabelValueBean(label, value));     }          public void removeEntries(String delstr[]) {         if (entries.size() > 0) {             for (int j = 0; j < delstr.length; j++) {                 for (int i = 0; i < entries.size(); i++) {                     LabelValueBean lvb = (LabelValueBean) entries.get(i);                     if (lvb.getValue().trim().equals(delstr[j])) {                         entries.remove(i);                         break;                     }                 }             }         }          }     public void removeAllEntries() {         entries.clear();     }     public int numberofNode(){                 return   entries.size();     }     private String arraynode[];     private String newnode;     private Collection nodeCollection;     private String submit;        public void setSubmit(String submit) {         this.submit = submit;     }     public String getSubmit() {         return this.submit;     }     public Collection getNodeCollection() {         return this.nodeCollection;     }     public void setNodeCollection(Collection nodeCollection) {         this.nodeCollection = nodeCollection;     }     public String[] getArraynode() {         return arraynode;     }     public void setArraynode(String arraynode[]) {         this.arraynode = arraynode;     }     public void setNewnode(String newnode) {         this.newnode = newnode;     }     public String getNewnode() {         return newnode;     } } action中的内容==========================         createnodeActionForm createnodeActionForm = (createnodeActionForm)                 actionForm;         String submit = createnodeActionForm.getSubmit().trim();         if(submit.equals("add")){             int size = createnodeActionForm.numberofNode()+1;             createnodeActionForm.addEntries(createnodeActionForm.getNewnode().trim(),""+size);         }else if(submit.equals("deleteselect")){             String arraynode []= createnodeActionForm.getArraynode();             if(arraynode  != null){                 createnodeActionForm.removeEntries(arraynode);             }                     }else if(submit.equals("deleteall")){             createnodeActionForm.removeAllEntries();         }         return actionMapping.findForward("createnode");     }

阅读全文(2306) | 回复(0) | 编辑 | 精华

 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)

 
 



The Neurotic Fishbowl

.: 公告




Bloginess

«November 2025»
1
2345678
9101112131415
16171819202122
23242526272829
30

.: 我的分类(专题)

首页(130)
RIA(22)
linux(3)
J2EE(24)
the mood of everyday(58)
oral English(14)
database(2)
soap(3)
java(9)
web developer center(14)


In the Bowl

.: 最新日志

倾情奉献iphone、ipod、ipho
check ipad's rotatio
css position fixed d
field validation whe
常见浏览器cookie个数和大小限制说明
人类无法抗拒的10种心理,学会它,就能控
读as3cookbook 有感
flex builder linux s
Component returned f
use tramp in emacs i


.: 最新回复

replcica watches
replcica watches
Dell spikes game sit
回复:人类无法抗拒的10种心理,学会它,
回复:人类无法抗拒的10种心理,学会它,
回复:flex builder linu
回复:人类无法抗拒的10种心理,学会它,
回复:人类无法抗拒的10种心理,学会它,
回复:致女人------摘自读者
回复:虚心接受别人的意见,谨慎改正


The Fishkeeper
blog名称:up forever
日志总数:130
评论数量:274
留言数量:4
访问次数:1954285
建立时间:2006年5月25日



Text Me

.: 留言板

签写新留言

参观
这个界面很漂亮!
我试试吧
up forever
该换了!


Other Fish in the Sea

.: 链接


http://blogger.org.cn/blog/more.asp?name=hongrui&id=16955

邢红瑞 

http://niegc.cublog.cn/  聂国聪

http://www.blogjava.net/SteelHand/ 铁手剑谱

http://blog.sina.com.cn/qianqq 糖qq

http://blog.csdn.net/misty_wish   师弟

http://www.bbxy.net/xiaoyu/ Goteet老师

http://www.chinaitpower.com    中国it动力

http://jinyuxi.blog.sohu.com/ 靳羽西




站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.563 second(s), page refreshed 144803595 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号