如何使用jsp、javascript、css以粗体或彩色显示表数据



我有一个显示数据库数据的web应用程序。它以0或数字显示结果。显示的数字应为粗体或某些颜色。如何在Web应用程序中以粗体显示数据库中的结果。

<svp:tbody rowCount="0" maxDisplayRows="100">
                                    <logic:iterate id="Typ" name="Typ">
                                        <logic:iterate id="ordType" name="ordTypes">
                                            <TR>
                                                <TD style="font-size: 9px"><bean:write name="Type"
                                                        property="TCode" /></TD>
                                                <TD style="font-size: 9px"><bean:write
                                                        name="Type" property="descr" /></TD>
                                                <%
                                                    for (int i = 0; i < 8; i++) {
                                                                                String idStr = i + "_order";
                                                %>
                                                <TD style="font-size: 9px"><INPUT class="inactive"
                                                    readonly="readonly"
                                                    id="${Typ.TCode}_${oType.OTypCode}_<%=idStr%>"
                                                    type="text" size="10" value="0"></TD>
                                                <%
                                                    }
                                                %>
                                            </TR>
                                        </logic:iterate>
                                    </logic:iterate>
                                </svp:tbody>

你的问题没有太多上下文,所以我只能建议

<td><b>value</b></td> //if you are using tables

b标签用于使字体加粗

你也可以使用

<td style='font-weight:bold'>value</td> //if you are using tables, css style

你也可以使用

<td class='bold'>value</td> //if you are using tables, css style
.bold //css class definition here
{
   font-weight:bold
}

您的代码确实很乱,但根据我的理解,我会尽力提供帮助。

假设你有一个<td>,它有一个特定的值,你想加粗吗?将样式属性添加到具有"font-weight:bold;"的td,使其从(例如)<td>变为<td style="font-weight:bold;">

如果只想用粗体显示非零数字,请使用condition?<what to return when true>:<what to return when false>:

int numberThatYouPut = ...;
<td>
    <%=numberThatYouPut!=0?"<b>"+numberThatYouPut+"</b>:numberThatYouPut%>
</td>

最新更新