html select 属性不显示数据库中的值而是显示第一个选项

html select attribute does not display value from database instead display the first option

我的代码出现了这个问题,我在此处获得的 select 属性不显示数据库中的值,而是显示 select 字段中的第一个选项。 这是代码:

<body>
   <g:form controller="customer" action="updateCustomer" class="updateCustomer" id="${cus.id}">
      <form>
         <div style="width:100%; padding-top: 50px; margin-right: auto; margin-left: auto; text-align: center">
            <div style = "height: 50vh; width: 70%; margin-left:auto; margin-right:auto;">
               <div>
                  %{--                        Table for customer client--}%
                  <table class="table table-striped" id="table t1">
                     <colgroup>
                        <col>
                        <col>
                        <col>
                        <col>
                        <col>
                     </colgroup>
                     <thead>
                        <tr>
                           <th colspan="5" style="height: 40px;>
                           <h6 style="font-weight: bold; margin-left: 40px;">
                              <g:link action="index" controller="customer">All Customers</g:link>
                              &nbsp;>>&nbsp;
                              <a href="#" onclick="goBack()">${cus.name}</a>&nbsp;>>&nbsp;EDIT
                           </h6>
                           </th>
                        </tr>
                        <tr>
                           <th colspan="5" style="height: 40px; text-align:center;background-color:lightseagreen">
                              <h6 style="font-weight: bold">EDIT CUSTOMER INFORMATION</h6>
                           </th>
                        </tr>
                

                        <tr style="height: 70px;background-color: #f7fafd;">
                           <td style = "width:30%;font-weight: bold; text-align: right;padding-right: 20px;"><span class="required">Status:</span></td>
                           <td style = "width:70%;font-weight: bold; text-align: left; padding-left: 20px;"> <g:select value = "${cus.status}" style = "width:90%" class="form-control" name="status" from="${["Active","Inactive"]}"></g:select></td>
                        </tr>


                        </tr>
                     </thead>
                  </table>
                  %{--                        End of table for customer client--}%
               </div>
            </div>
         </div>
      </form>
   </g:form>

中相当于 HTLM 中的 select 属性,我已经给出了值 ${cus.status} 但是每当我进入 EDIT 客户页面时而不是在
中显示该值 select 菜单显示的是 select 的第一个值,它是活动的。 在此示例中,用户的状态为“非活动”

但是当我点击“编辑”按钮时,状态是 'Active' 有什么办法可以解决这个问题吗? 非常感谢。

我必须用这个替换我的 table 行:

   <tr style="height: 70px;background-color: #f7fafd;">
                            <td style = "width:30%;font-weight: bold; text-align: right;padding-right: 20px;"><span class="required">Status:</span></td>
                            <td style = "width:70%;font-weight: bold; text-align: left; padding-left: 20px;">
                                <select style = "width:90%"class = "form-control" name="status">
                                    <option disabled selected value> -- Select an option -- </option>
                                    <option value="selectValue" disabled selected hidden>${cus.status}</option>
                                    <option value="Active" select>Active</option>
                                    <option value="Inactive" select>Inactive</option>

                                </select>
                            </td>
                        </tr>