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

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

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

      Struts 2 选择标签默认值

      时间:2023-09-24

          <legend id='1qLv4'><style id='1qLv4'><dir id='1qLv4'><q id='1qLv4'></q></dir></style></legend>
            <bdo id='1qLv4'></bdo><ul id='1qLv4'></ul>

            <small id='1qLv4'></small><noframes id='1qLv4'>

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

                <tfoot id='1qLv4'></tfoot>
              1. 本文介绍了Struts 2 选择标签默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 Struts 创建一个数据库记录编辑表单.

                I'm creating a database record edit form using Struts.

                <s:select id="status" name="newRecord.status" list="statusTypes" listKey="id" listValue="description" label="Status:" value="" /><br />
                

                示例列表:

                Status' list: 
                1 Open 
                2 Closed 
                3 Pending
                

                我想在状态字段上设置一个默认值作为存储在 record.status 中的当前状态,其中包含字符串表示,例如打开".

                I want to set a default value on the status field as the current status which is stored in record.status which contains the string representation e.g. "Open".

                如果我设置 value="%{record.status} 它不起作用,因为这不是任何列表键.当我只有字符串表示形式时,有没有办法设置这个值合作吗?

                If I set value="%{record.status} it doesn't work because that's not any list key. Is there a way I can set this value when I only have the string representation to work with?

                或者我应该将 record.status 重新设计为具有 ID 和 String 的对象吗?

                Or should I redesign record.status to be an object with ID and String?

                推荐答案

                您应该初始化 newRecord.status 的值,该值应该是包含列表键值的单独属性.然后只需设置默认的 value="%{record.status}".当我说属性时,我指的是可通过 OGNL 访问的 bean 属性.

                You should initialize the value of the newRecord.status that should be a separate property that contains the list key value. Then simply set the default value="%{record.status}". When I said the property I mean the bean property that is accessible via OGNL.

                这篇关于Struts 2 选择标签默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:资源在 Struts 2 中不可用 下一篇:Struts 2 jquery sj:select 和 json 结果

                相关文章

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

                    <small id='1Ajgw'></small><noframes id='1Ajgw'>

                      <bdo id='1Ajgw'></bdo><ul id='1Ajgw'></ul>

                  1. <legend id='1Ajgw'><style id='1Ajgw'><dir id='1Ajgw'><q id='1Ajgw'></q></dir></style></legend>