1. <tfoot id='G3iBD'></tfoot>

    2. <small id='G3iBD'></small><noframes id='G3iBD'>

        <bdo id='G3iBD'></bdo><ul id='G3iBD'></ul>
      <legend id='G3iBD'><style id='G3iBD'><dir id='G3iBD'><q id='G3iBD'></q></dir></style></legend>
      <i id='G3iBD'><tr id='G3iBD'><dt id='G3iBD'><q id='G3iBD'><span id='G3iBD'><b id='G3iBD'><form id='G3iBD'><ins id='G3iBD'></ins><ul id='G3iBD'></ul><sub id='G3iBD'></sub></form><legend id='G3iBD'></legend><bdo id='G3iBD'><pre id='G3iBD'><center id='G3iBD'></center></pre></bdo></b><th id='G3iBD'></th></span></q></dt></tr></i><div id='G3iBD'><tfoot id='G3iBD'></tfoot><dl id='G3iBD'><fieldset id='G3iBD'></fieldset></dl></div>
    3. 如何让 Struts 单选标签创建单选按钮的垂直列表

      时间:2023-09-25

      <legend id='qq8bO'><style id='qq8bO'><dir id='qq8bO'><q id='qq8bO'></q></dir></style></legend>

          • <bdo id='qq8bO'></bdo><ul id='qq8bO'></ul>

            <i id='qq8bO'><tr id='qq8bO'><dt id='qq8bO'><q id='qq8bO'><span id='qq8bO'><b id='qq8bO'><form id='qq8bO'><ins id='qq8bO'></ins><ul id='qq8bO'></ul><sub id='qq8bO'></sub></form><legend id='qq8bO'></legend><bdo id='qq8bO'><pre id='qq8bO'><center id='qq8bO'></center></pre></bdo></b><th id='qq8bO'></th></span></q></dt></tr></i><div id='qq8bO'><tfoot id='qq8bO'></tfoot><dl id='qq8bO'><fieldset id='qq8bO'></fieldset></dl></div>
            <tfoot id='qq8bO'></tfoot>

              1. <small id='qq8bO'></small><noframes id='qq8bO'>

                  <tbody id='qq8bO'></tbody>
                本文介绍了如何让 Struts 单选标签创建单选按钮的垂直列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用一个 struts 单选标签,该标签填充了具有两个字段的对象列表:

                类 MyAction {列出<我的对象>我的清单;字符串 selectedId公共字符串执行(){...myList = new ArrayList();myList.add(new MyObject("1","first object");myList.add(new MyObject("2","第二个对象");myList.add(new MyObject("3","第二个对象");...}//myList & 的 Getter 和 Setter选定的Id...}类我的对象 {字符串标识;字符串名称;我的对象(字符串 id,字符串名称){这个.id = id;this.name = 名称;}//id & 的 Getter 和 Setter名称...}

                这是我在页面上用来显示单选按钮列表的内容

                <s:radio key="selectedId" list="myList" listKey="id" listValue="name"/>

                但是,这会生成单选按钮的水平列表.我尝试为它们添加 css 样式:

                <style>.垂直输入{显示:块;}</风格>

                但这会导致标签和单选按钮也显示在不同的行上,而不是单选按钮和标签显示在同一行:

                <块引用>
              2. 第一个对象
              3. 第二个对象
              4. 第三个对象

                我想要的是:

                <块引用>
              5. 第一个对象
              6. 第二个对象
              7. 第三个对象
              8. 解决方案

                其实很简单,我的意思是使用主题 simple :)

                <s:iterator value="myList"><s:radio theme="simple" name="someNameToSubmit" list="#{id:name}"/><br></s:迭代器>

                这将使 name 作为标签,id 作为要提交的属性

                I'm using a struts radio tag that is being populated with a list of objects that have two fields:

                class MyAction {
                     List<MyObject> myList;
                     String selectedId
                     public String execute() {
                         ...
                         myList = new ArrayList<MyObject>();
                         myList.add(new MyObject("1","first object");
                         myList.add(new MyObject("2","second object");
                         myList.add(new MyObject("3","second object");
                         ...
                     }
                
                     // Getters and Setters for myList & selectedId
                     ...
                }
                
                class MyObject {
                    String id;
                    String name;
                
                    MyObject(String id, String name) {
                         this.id = id;
                         this.name = name;
                    }
                    // Getters and Setters for id & name
                    ...
                }
                

                Here's what I was using on my page to display the list of radio buttons

                <s:radio key="selectedId" list="myList" listKey="id" listValue="name"/>
                

                However, this yields a horizontal list of radio buttons. I tried adding a css style to them:

                <style>
                    .vertical input { display: block; }
                </style>
                

                But this causes the labels and the radio buttons to show up on separate lines as well, instead of the radio button and label on the same line:

              9. first object
              10. second object
              11. third object

                what I want is:

              12. first object
              13. second object
              14. third object
              15. 解决方案

                its actually simple, i mean use theme simple :)

                <s:iterator value="myList"> 
                  <s:radio theme="simple" name="someNameToSubmit" list="#{id:name}"/><br>
                </s:iterator> 
                

                This will make name as a label and id as the property to submit

                这篇关于如何让 Struts 单选标签创建单选按钮的垂直列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Struts Web 应用程序:可重用验证客户端和服务器端 下一篇:调度程序初始化失败.java.lang.ClassNotFoundException: org.apache.strut

                相关文章

                <legend id='PqHaE'><style id='PqHaE'><dir id='PqHaE'><q id='PqHaE'></q></dir></style></legend>

                1. <small id='PqHaE'></small><noframes id='PqHaE'>

                      <bdo id='PqHaE'></bdo><ul id='PqHaE'></ul>

                  1. <i id='PqHaE'><tr id='PqHaE'><dt id='PqHaE'><q id='PqHaE'><span id='PqHaE'><b id='PqHaE'><form id='PqHaE'><ins id='PqHaE'></ins><ul id='PqHaE'></ul><sub id='PqHaE'></sub></form><legend id='PqHaE'></legend><bdo id='PqHaE'><pre id='PqHaE'><center id='PqHaE'></center></pre></bdo></b><th id='PqHaE'></th></span></q></dt></tr></i><div id='PqHaE'><tfoot id='PqHaE'></tfoot><dl id='PqHaE'><fieldset id='PqHaE'></fieldset></dl></div>

                  2. <tfoot id='PqHaE'></tfoot>