`
chenzdong
  • 浏览: 16279 次
  • 性别: Icon_minigender_1
最近访客 更多访客>>
文章分类
社区版块
存档分类

struts中〈html:select嵌套使用<logic:iterate 〉的问题?

阅读更多
<body>
  <% Vector accounts= new Vector();
  accounts.addElement("bj001");
  accounts.addElement("011011");
  request.setAttribute("accounts",accounts);
  %>
    <html:form action="selectAccount.do"  >
      <table border="0">
        <tr>
          <td>Account:</td>
          <td>
          <html:select property="account">
          <logic:iterate id="account" name="accounts">
          <html:option value="">
          <bean:write name="account"/>
          </html:option>
          </logic:iterate>
         
         
          </html:select>
          </td>
        </tr>
       
        <tr>
          <td colspan="2" align="center"><html:submit /></td>
        </tr>
      </table>
    </html:form>

上面是我的代码,我在对应的action中想取得select中选中的值,却发现无法取出;如果在select标签中用<html:option >不使用迭代输出就可以??有没有什么办法能解决用<logic:iterate >也能在action中取得选中的值?请指点
分享到:
评论
7 楼 jin.libing 2006-12-21  
jstl
6 楼 chenzdong 2006-11-06  
yjhmily 写道
其实用普通的select就可以嵌套<logic:iterate>标签了!有时候struts的标签要灵活取舍的!呵呵!



不管是否使用struts的select标签,用select控件的话,也是无法实现对option value的动态赋值??如何实现?
5 楼 yjhmily 2006-11-06  
其实用普通的select就可以嵌套<logic:iterate>标签了!有时候struts的标签要灵活取舍的!呵呵!
4 楼 chenzdong 2006-11-06  
谢谢楼上指点,有没有什么办法可以给<html:option >中的value动态赋值,使value的值和每次<bean:write name="account"/>输出的值相等????
<html:select property="account">
      <logic:iterate id="account" name="accounts">
          <html:option value="***">
             <bean:write name="account"/>
          </html:option>
      </logic:iterate>
</html:select>
3 楼 together 2006-11-06  
why要使用标签?
讲个理由先。

可能是我的RPWT,我至今也没看出这一堆乱七八糟互不兼容的标签有什么用。
2 楼 stone 2006-11-06  
use:
<html:select property="account">
                                <html:options collection="accountList" property="value"
                                              labelProperty="label"/>
                            </html:select>

and the error in your code is:
# <html:option value="">  ----value=""
#                         <bean:write name="account"/> 
#                     </html:option> 
1 楼 抛出异常的爱 2006-11-06  
chenzdong 写道

<body>
  	<% Vector accounts= new Vector();
  		accounts.addElement("bj001");
  		accounts.addElement("011011");
  		request.setAttribute("accounts",accounts);
  	 %>
    <html:form action="selectAccount.do"  >
      <table border="0">
        <tr>
          <td>Account:</td>
          <td>
          	<html:select property="account">
          		<logic:iterate id="account" name="accounts">
          			<html:option value="">
          				<bean:write name="account"/>
          			</html:option>
          		</logic:iterate>
          		
          		
          	</html:select>
          </td>
        </tr>
        
        <tr>
          <td colspan="2" align="center"><html:submit /></td>
        </tr>
      </table>
    </html:form>

上面是我的代码,我在对应的action中想取得select中选中的值,却发现无法取出;如果在select标签中用<html:option >不使用迭代输出就可以??有没有什么办法能解决用<logic:iterate >也能在action中取得选中的值?请指点


有种标签叫nested:select
还有种标签叫nested:iterate

相关推荐

    Struts标签的使用

    这些标签包括`&lt;html:base&gt;`、`&lt;html:cancel&gt;`、`&lt;html:select&gt;`、`&lt;html:checkbox&gt;`、`&lt;html:radio&gt;`、`&lt;html:multibox&gt;`、`&lt;html:link&gt;`、`&lt;html:errors&gt;`、`&lt;html:javascript&gt;`、`&lt;html:xhtml&gt;`等。例如,`...

    Struts标签库 ppt教程

    表单相关的标签,如`&lt;html:form&gt;`、`&lt;html:text&gt;`、`&lt;html:password&gt;`、`&lt;html:textarea&gt;`、`&lt;html:hidden&gt;`、`&lt;html:radio&gt;`、`&lt;html:checkbox&gt;`、`&lt;html:multibox&gt;`、`&lt;html:select&gt;`、`&lt;html:submit&gt;`、`...

    struts标准手册

    3. **Logic Tags**:用于实现逻辑判断、循环迭代等功能,是Struts中非常重要的组成部分。 4. **Nested Tags**:建立在Bean Tags、HTML Tags和Logic Tags基础上,支持标签嵌套。 5. **Tiles Tags**:用于构建页面布局...

    Struts1标签手册

    其次,HTML Tags库则包含了用于创建Struts输入表单的标签,如`&lt;html:base&gt;`, `&lt;html:cancel&gt;`, `&lt;html:select&gt;`, `&lt;html:checkbox&gt;`, `&lt;html:radio&gt;`, `&lt;html:multibox&gt;`, `&lt;html:link&gt;`, `&lt;html:errors&gt;`, `...

    Struts2核心标签注解

    这段代码展示了如何使用`&lt;html:form&gt;`创建一个表单,以及如何使用`&lt;html:text&gt;`、`&lt;html:password&gt;`、`&lt;html:radio&gt;`和`&lt;html:select&gt;`等标签来构建不同的表单元素。此外,通过设置`property`属性,可以实现表单数据...

    JSP Struts之HTML标签库详解.txt

    根据提供的文件信息,可以看出本文主要关注的是JSP Struts框架中的HTML标签库的使用与解析。Struts是一个基于MVC(Model-View-Controller)设计模式的开源框架,主要用于简化Web应用程序的开发过程。其中,HTML标签...

    Struts标签库学习.rar

    第三部分,"Struts中的下拉列表标签的使用.doc"讲解了如何使用Struts的`&lt;html:select&gt;`、`&lt;html:option&gt;`和`&lt;html:optionsCollection&gt;`标签来创建下拉列表。这些标签允许开发者动态生成选项,可以绑定到ActionForm的...

    struts1.x标签详解

    &lt;logic:iterate id="item" name="items" indexId="index"&gt; Item &lt;bean:write name="index" /&gt;: &lt;bean:write name="item" /&gt;&lt;br/&gt; &lt;/logic:iterate&gt; ``` ##### 2. logic:present 用于判断某个对象是否存在于某个...

    struts1标签库详解.doc

    接下来,Logic Tags库提供了逻辑判断和流程控制的标签,如`&lt;logic:iterate&gt;`用于遍历集合,`&lt;logic:present&gt;`和`&lt;logic:notPresent&gt;`检查指定的bean或请求参数是否存在于当前上下文中,`&lt;logic:equal&gt;`和`&lt;logic:not...

    struts标签使用例子

    - `tiles:useAttribute`:在模板中使用ActionForm或其他Bean的属性。 5. **html:errors**: 这个标签用于显示由Struts验证框架产生的错误信息,提高用户体验。 6. **html:form**: 创建表单,关联到一个Action...

    truts专用标签库详解

    3. `html`标签库:这是最常用的一组标签,用于创建HTML表单元素,如输入字段(`&lt;html:text&gt;`、`&lt;html:password&gt;`)、按钮(`&lt;html:submit&gt;`、`&lt;html:image&gt;`)、选择项(`&lt;html:options&gt;`、`&lt;html:select&gt;`)等。...

    sturt各种标签学习

    逻辑标签库(Logic标签)主要包含处理控制流程的标签,如`&lt;logic:iterate&gt;`、`&lt;logic:equal&gt;`等,它们帮助开发者在JSP页面中实现条件判断和循环等逻辑操作。 Nested标签库则是为了处理嵌套的Bean属性,使得在复杂的...

    tree_maker

    3. **logic标签**:处理条件和迭代逻辑,如if、else、iterate等。 4. **nested标签**:支持复杂视图结构,使嵌套JSP元素的引用更加方便。 5. **tiles标签**:与Tiles框架集成,用于插入和管理页面组件。 6. **...

Global site tag (gtag.js) - Google Analytics