Nul and empty string judgments in JSP __js

Source: Internet
Author: User

The use of empty in El expression

<c:if test= "${not Empty Logisticsdetaillist}" >
<c:foreach items= "${logisticsdetaillist}" var= "List" >
<tr>
<TD align= "center" >
${list.time}&nbsp;
</td>
<TD align= "Left" >
<span style= "Display:block" title= "${list.contenxt}" >${list.contenxt}</span>
</td>
</tr>
</c:forEach>
</c:if>
<c:if test= "${empty logisticsdetaillist}" >
<tr>
<TD align= "center" colspan= "2" >
<span style= "color: #003688; font-weight:bold;font-size:16px" > Temporary no logistics information!</span>
</td>
</tr>
</c:if>

<c:if test= "${! Empty Key}" >${key}</c:if> or <c:if test= "${not Empty Key}" > <c:if test= "${empty Key}" "> All </c:if> Output key value when key is not empty. When key is empty, the output "all" rule: 1 if the key is null, returns True 2 if the key is an empty string, returns True 3 if the key is an empty array, returns true 4 if the key is an empty map, returns true 5 if the key is null C Returns True 6 when Ollection, returns false

Second, struts2 tags for null and empty string judgments

<s:if test= "#request .logisticsdetaillist!=null&& #request. logisticsdetaillist.size>0" >

You can also use this: <s:if test= "#request. logisticsdetaillist!=null&&! #request. Logisticsdetaillist.isempty ()" >
<c:foreach items= "${logisticsdetaillist}" var= "List" >
<tr>
<TD align= "center" >
${list.time}&nbsp;
</td>
<TD align= "Left" >
<span style= "Display:block" title= "${list.contenxt}" >${list.contenxt}</span>
</td>
</tr>
</c:forEach>
</s:if>

<s:if test= "#request .logisticsdetaillist!=null&& #request. logisticsdetaillist.size>0" > If a string can <s:if test= "#request .username!=null&& #request. username!=" "> Single quote

This can also be done with the same effect.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.