1

我需要隐藏最后一列,它是基于从弹簧控制器传递的模型对象的复选框。如果模型值为“isAll”,则应该隐藏任何其他值,如果它应该是可见的,我已经尝试过,但到目前为止失败了。我不确定我是否正确地从控制器传递了值。帮助!

控制器:

    System.err.println("Type is: " + formbean.getType());
System.err.println("IscCode is: " + formbean.getForecastIsc());
System.err.println("ActualIscCode is: " + formbean.getActualIsc());
System.err.println("labelNbr is: " + formbean.getLabelNbr());
System.err.println("senderOp is: " + formbean.getSenderOp());       
System.err.println("senderLastName is: " + formbean.getSenderLastName());
System.err.println("receiverOp is: " + formbean.getReceiverOp());
System.err.println("receiverLastName is: " + formbean.getReceiverLastName());


    summary = summarySelectDao.getSummary(formbean);    
    if(summary == null || summary.size() == 0){         
        errorMessage = "No Parcel Analysis Cases Found!";
return new ModelAndView("redirect:/analysis/analysisSelection? hasError=true");
    }else{
    logger.info("Total " + summary.size() + " analysis cases found from DB.");
        model.addObject("summary", summary);
        model.addObject("isAll", true);  //BASED on this model if true
    }

    return model;       

JSP:

<td class="ct"<c:out value="${summary.country}" /></td>
 <td class="sc" <c:out value="${summary.source}" /></td>
 <td  class="cb" <input type="checkbox" value=""> </td>

JS:

$(document).ready(function() {
$(".cb").hide();    
}); 

HTML:

   <div id=table1>
<table id="summaryTable" class="sortable">
    <thead>
        <tr>
            <th>&nbsp;</th>
            <th>Bar Code</th>
            <th>Origin</th>
            <th>Sender Name</th>
            <th>Recipient Name</th>
            <th>USPS Mail<br>Receipt Date</th>
            <th><br>Load Date</th>
            <th>Fore-<br>cast<br> ISC</th>
            <th>Act-<br>ual<br> ISC</th>
            <th>Country</th>
            <th>Source</th>
<th class="cb"><input type="button" id="btnSelectAllCbl" name="selectCheckBox"
            value="Update"> </th>
        </tr>
    </thead>
    <tbody> 
        <tr>

                <tr>
<td bgcolor='yellow'>P
    </td>
    <td bgcolor='yellow'><a href="AnalysisController?value=xxxxx">xxxxx
    </a>
    </td>
    <td bgcolor='yellow'>55025
                    </td>
    <td bgcolor='yellow'>xxxx
                    </td>
    <td bgcolor='yellow'>SON
    </td>
 <td  bgcolor='yellow'>
        </td>
<td bgcolor='yellow'>2013/02/11 060205
</td>
<td bgcolor='yellow'>ORD
                    </td>
<td bgcolor='yellow'>ORD
                    </td>
                    <td  bgcolor='yellow'>SINGAPORE
                    </td>
                    <td  bgcolor='yellow'>RECIPIENT
                    </td>
                    <td class="cb" bgcolor='yellow'><input
                        type="checkbox" value="">
                    </td>
4

1 回答 1

2

最简单的方法:用于<c:if>打印/不打印列:

<c:if test="${isAll}">
    <td  class="cb"><input type="checkbox" value=""></td>
</c:if>

对列标题也执行相同的操作。

于 2013-03-14T04:19:52.077 回答