Struts2中select/doubleselect标签数据显示

论坛 期权论坛     
选择匿名的用户   2021-6-2 17:25   461   0
  
<p style="text-indent:21pt;">最近做毕业设计用到<span style="font-family:&#39;Courier New&#39;;">Struts2 </span>的标签库,遇到一些比较复杂的数据显示,个人还是比较喜欢用<span style="font-family:&#39;Courier New&#39;;">tag</span>显示的,<span style="font-family:&#39;Courier New&#39;;">Struts2 tags</span>内容丰富,但是所提供的文档不是很详细(个人认为)在<span style="font-family:&#39;Courier New&#39;;">showcase</span>下的例子如<span style="font-family:&#39;Courier New&#39;;">:&lt;s:select /&gt; &lt;s:doubleselect /&gt; &lt;s:updownselect /&gt; &lt;s:optiontransferselect /&gt;</span>等都是一些简单的值显示,在实际的开发中并没有那么简单,如果我们要迭代显示<span style="font-family:&#39;Courier New&#39;;">List</span>、<span style="font-family:&#39;Courier New&#39;;">Map</span>、<span style="font-family:&#39;Courier New&#39;;">Set</span>里的值,我们该怎样做呢?<span style="font-family:&#39;Courier New&#39;;"><br><br>     </span>看看<span style="font-family:&#39;Courier New&#39;;">html</span>里的例子,</p>
<table border="1" cellpadding="0" cellspacing="0" style="border-right:medium none;border-top:medium none;border-left:medium none;border-bottom:medium none;border-collapse:collapse;"><tbody><tr><td style="width:426.1pt;" width="568"> <p align="left" style="text-align:left;"><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&lt;</span><span style="font-size:10pt;color:#3f7f7f;font-family:&#39;Courier New&#39;;">select </span><span style="font-size:10pt;color:#7f007f;font-family:&#39;Courier New&#39;;">name</span><span style="font-size:10pt;color:#000000;font-family:&#39;Courier New&#39;;">&#61;</span><span style="font-size:10pt;color:#2a00ff;font-family:&#39;Courier New&#39;;">&#34;sex&#34;</span><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&gt;</span></p> <p align="left" style="text-align:left;"><span style="font-size:10pt;color:#000000;font-family:&#39;Courier New&#39;;">    </span><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&lt;</span><span style="font-size:10pt;color:#3f7f7f;font-family:&#39;Courier New&#39;;">option </span><span style="font-size:10pt;color:#7f007f;font-family:&#39;Courier New&#39;;">value</span><span style="font-size:10pt;color:#000000;font-family:&#39;Courier New&#39;;">&#61;</span><span style="font-size:10pt;color:#2a00ff;font-family:&#39;Courier New&#39;;">&#34;man&#34;</span><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&gt;</span>男<span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&lt;/</span><span style="font-size:10pt;color:#3f7f7f;font-family:&#39;Courier New&#39;;">option</span><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&gt;</span></p> <p align="left" style="text-align:left;"><span style="font-size:10pt;color:#000000;font-family:&#39;Courier New&#39;;">    </span><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&lt;</span><span style="font-size:10pt;color:#3f7f7f;font-family:&#39;Courier New&#39;;">option </span><span style="font-size:10pt;color:#7f007f;font-family:&#39;Courier New&#39;;">value</span><span style="font-size:10pt;color:#000000;font-family:&#39;Courier New&#39;;">&#61;</span><span style="font-size:10pt;color:#2a00ff;font-family:&#39;Courier New&#39;;">&#34;women&#34;</span><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&gt;</span>女<span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&lt;/</span><span style="font-size:10pt;color:#3f7f7f;font-family:&#39;Courier New&#39;;">option</span><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&gt;</span></p> <p><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&lt;/</span><span style="font-size:10pt;color:#3f7f7f;font-family:&#39;Courier New&#39;;">select</span><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&gt;</span></p> </td></tr></tbody></table>
<p style="text-indent:21pt;"><span style="font-family:&#39;Courier New&#39;;">Sex</span>表示提交的<span style="font-family:&#39;Courier New&#39;;">name</span>,<span style="font-family:&#39;Courier New&#39;;">man/women</span>是对应页面显示提交后所代表的值,男<span style="font-family:&#39;Courier New&#39;;">/</span>女则为页面最终看到的值<span style="font-family:&#39;Courier New&#39;;"><br><br>     </span>而如果我们要显示一个<span style="font-family:&#39;Courier New&#39;;">List</span>集合里的数据该怎么做呢?<span style="font-family:&#39;Courier New&#39;;"><br>     </span>看下面的<span style="font-family:&#39;Courier New&#39;;">Jsp</span>页面:<span style="font-family:&#39;Courier New&#39;;"><br><br></span></p>
<table border="1" cellpadding="0" cellspacing="0" style="border-right:medium none;border-top:medium none;border-left:medium none;border-bottom:medium none;border-collapse:collapse;"><tbody><tr><td style="width:426.1pt;" width="568"> <p align="left" style="text-align:left;"><span style="font-size:10pt;color:#008080;font-family:&#39;Courier New&#39;;">&lt;</span><span style="font-size:10pt;color:#3f7f7f;font-family:&#39;Courier New&#39;;">select </span><span style="font-size:10pt;color
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP