【问题标题】:Can Struts2 Checkbox be created with Bootstrap?Struts2 Checkbox 可以用 Bootstrap 创建吗?
【发布时间】:2017-02-23 17:55:53
【问题描述】:

我想知道 struts2 <s:checkbox> 是否在引导形式下创建。请看一下我的jsp代码。复选框没有出现。如果我像 input type="checkbox" 这样的正常方式创建一个复选框,它会显示出来,但我必须使用 struts2 标签创建它才能使用 struts2 操作处理表单。

jsp

<s:form action="exportDocumentExport" namespace="/esignmain/documentExport" name="documentExportForm" theme="bootstrap" cssClass="form-vertical">
        <%-- Message --%>
        <div class="message">
            <s:if test="message != null">
                <strong style="color:#7F0E11"><s:property value="message"/></strong>
            </s:if>
        </div>

    <s:if test="message == null">
    <div class="scrollView11">
        <table id="eSignUsers" class="table table-hover">
            <thead>
                <tr>
                    <th><s:text name="S.NO"/></th>
                    <th><s:text name="Document identifier"/></th>
                    <th><s:text name="Name"/></th>
                    <th><s:text name="Description"/></th>
                    <th><s:text name="Active"/></th>            
                </tr>
            </thead>
            <tr>
                <s:iterator value="documentList" status="status">
                    <tbody>
                        <tr>    
                            <td><s:property value="#status.count" /></td>
                            <td><s:property value="identifier" /></td> 
                            <td><s:property value="name" /></td>
                            <td><s:property value="description" /></td>
                            <td><s:property value="active" /></td>
                            <td><s:checkbox name="checked" fieldValue="%{id}" value="false"/></td>  
                        </tr>       
                    </tbody>                                
                </s:iterator>
            </tr>
            <tr>
                <table class="table table-striped">
                    <tr>
                        <h5>Showing <span id="totalRows" class="label label-success"></span> total records</h5>
                        <s:submit key="Export Document" value="Export Document" type="button" class="btn btn-sm btn-success" name="Export_Document" theme="simple" onclick="return evalGroup()"><span class="glyphicon glyphicon-export"></span> Export</s:submit>
                    </tr>   
                </table>
            </tr> 
    </table>
</div>  

谢谢

【问题讨论】:

  • 发布代码以显示您如何引导复选框
  • 请详细说明
  • 我已经更新了我的问题。
  • S2 标签只产生标记;除了方便和一些最小的框架集成之外,您没有理由必须使用它们。您可能对github.com/struts-community-plugins/struts2-bootstrap 感兴趣。

标签: html twitter-bootstrap struts2


【解决方案1】:

我猜你想使用&lt;s:checkbox&gt;创建一个Bootstrap风格的复选框

试试这个:

<div class="checkbox">
  <label>
    <s:checkbox name="..."/>
    Your label here
  </label>
</div>

【讨论】:

  • 我的意思是我没有看到任何复选框,因为 s:checkbox 标签。
  • @fustaki,它奏效了。实际上看起来无论我们是否需要它都必须有一个标签属性。添加标签后,复选框正确显示。
【解决方案2】:

我会推荐 Struts2 Bootstrap 插件项目。它处理提供的 jsp 模板中的所有引导标记

http://struts.jgeppert.com/struts2-bootstrap-showcase/index.action

【讨论】:

    猜你喜欢
    • 2019-07-06
    • 1970-01-01
    • 1970-01-01
    • 2011-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多