Hello everyone:
Today, a problem is the background forward to the list, the front desk to determine the length of the list!
All the others said they had to add another label.
<span style= "Font-size:14px;color: #cc0000;" >jsp often have to judge the length of a list or string to do something because the IF in the JSTL tag does not support else, so choose while to do it. <%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%><%@ taglib uri= "http://java.sun.com/jsp/ Jstl/functions "prefix=" FN "%>--------here need to have standard.jar this package to introduce two tag libraries can be achieved length judgment, such as the JSP Code Collection code <c: choose> <c:when test= "${fn:length (contact.tagschosen) = = 0}" > <span class= "grouped" > ungrouped < /SPAN> </c:when> <c:otherwise> <c:foreach items= "${contact.tagschosen}" var= "tags" > <span class= "grouped" >${tags.tagname}</span> </c:forEach> </c:otherwise > </c:choose> </span>
and what I'm going to say today is just <%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%> this tag just fine.
Just add an implicit tag to the body and you'll be able to easily judge
<input type= "hidden" name= "tcmedicinelist" value= "${tcmedicinelist}"/>
<c:if test= "${tcmedicinelist.size () >2}" >
This will be OK!!!
<span style= "FONT-SIZE:14PX;" ><body><input type= "hidden" name= "tcmedicinelist" value= "${tcmedicinelist}"/><input type= "hidden "Name=" Wemedicinelist "value=" ${wemedicinelist} "/><input type=" hidden "name=" otmedicinelist "value=" ${ Otmedicinelist} "/><input type=" hidden "name=" trmedicinelist "value=" ${trmedicinelist} "/><input type=" Hidden "name=" ptcmedicinelist "value=" ${ptcmedicinelist} "/><!--recipe start--><div class=" Container " > <dl class= "recipe_pay_detail recipe_detail" > <dt class= "medicine_head" ><i class= "ico ico _recipe Recipe_bg6 "></i> herbal medicine:</dt> <dd id=" Medicine_info_chn "> </s Pan><span style= "Font-size:18px;color: #ff6600;" > <span style= "Background-color:rgb (102, 0, 204); ><c:foreach items= "${tcmedicinelist}" var= "Tcmedicinelist" begin= "0" end= "1" ></span></span> <span style= "Color:rgb (255, 102, 0); font-size: 18px; Font-family:arial, Helvetica, Sans-serif; > </span><span style= "Color:rgb (255, 102, 0); font-size:18px; Font-family:arial, Helvetica, Sans-serif; ><!--Loop list shows only the first two--></span>
<span style= "FONT-SIZE:14PX;" > <p><span>${tcmedicinelist.name}</span>${tcmedicinelist.standard} </p> < ;/c:foreach> </span><strong style= "FONT-SIZE:14PX;" > </strong><span style= "font-size:18px;" > </span><span style= "color: #ff9900;" ><span style= "FONT-SIZE:18PX;" ><span style= "Background-color:rgb (51, 102, 255); > <c:if test= "${tcmedicinelist.size ()!=0&&2>tcmedicinelist.size ()}" ></span> </span ><span style= "FONT-SIZE:14PX;" > </span></span><span style= "Color:rgb (255, 102, 0); font-size:18px; Font-family:arial, Helvetica, Sans-serif; ><!--If the list bar number is not equal to 0 and the number of bars is less than 2--></span><span style= "FONT-SIZE:14PX;" ><span style= "color: #ff9900;" ></span> <c:foreach items= "${ptcmedicinelist}" var= "Ptcmedicinelist" <span style= "Background-color: RGB (51, 102, 255); " ><span style= "COLOR: #ff0000; " > begin= "0" end= "0" </span></span>> <p> dosage: ${ptcmedicinelist.num} ${ptcmedicineli st.unit}<br/> <%--dosage:${ptcmedicinelist.dosage}<br>--%> usage: ${ptcmedicinelist.usemethod} ${ptcmedicinelist.dosage} </p> </c:forEach> </c:if> <c:i F test= "${tcmedicinelist.size () >2}" > </span><span style= "Color:rgb (255, 102, 0); Font-family:arial, Helvetica, Sans-serif; font-size:18px; " ><!--If the list number is greater than 2--></span><span style= "FONT-SIZE:14PX;" > <c:foreach items= "${ptcmedicinelist}" var= "Ptcmedicinelist" <span style= "Background-color:rgb (51, 10 2, 255); " ><span style= "color: #ff6600;" >begin= "0" end= "0" ></span></span><span style= "color: #ffff66;" >></span> </span><span style= "Color:rgb (255, 102, 0); Font-family:arial, Helvetica, sans-serif;font-size:18px; ><!--Cycle LThe IST displays only the previous--></span><span style= "FONT-SIZE:14PX;" > <p> dosage: ${ptcmedicinelist.num} ${ptcmedicinelist.unit}<br/> Usage: ${ptcmedicinelist.usem Ethod} ${ptcmedicinelist.dosage} <a href= "#" class= "btn btn_o_c btn_open" id= "Btn_open_chn" > Expand </a> </p> </c:forEach> </c:if> </dd> <dd id= "Me Dicine_detail_chn "> <c:foreach items=" ${tcmedicinelist} "var=" Tcmedicinelist "> <p> <sp An>${tcmedicinelist.name}</span>${tcmedicinelist.standard}</p> </c:forEach> <c:for Each items= "${ptcmedicinelist}" var= "Ptcmedicinelist" begin= "0" end= "0" ></span><span style= "Color:rgb ( 255, 102, 0); Font-family:arial, Helvetica, sans-serif;font-size:18px; ><!--Loop list shows only the previous--></span><span style= "FONT-SIZE:14PX;" > <p> dosage: ${ptcmedicinelist.num} ${ptcmediciNelist.unit}<br/> usage: ${ptcmedicinelist.usemethod} ${ptcmedicinelist.dosage} <a href= "#" class= "Btn Btn_o_c btn_close" id= "Btn_close_chn" > Close </a> </p> </c:forEach> </d d> <dt class= "Medicine_head" ><i class= "ico ico_recipe Recipe_bg4" ></i> Western medicine:</dt> <dd id= "Medicine_info" > <c:foreach items= "${wemedicinelist}" var= "Wemedicinelist" begin= " 0 "end=" 1 "> <p><span>${weMedicineList.name}</span>${weMedicineList.standard}</p> & lt;/c:foreach> <c:if test= "${wemedicinelist.size () >2}" > <p>...<a href= "#" class= "btn Btn_o_c btn_open "id=" Btn_open "> Expand </a></p> </c:if> </dd> & Lt;dd id= "Medicine_detail" > <c:foreach items= "${wemedicinelist}" var= "Wemedicinelist" > <p& Gt;<span>${wemedicInelist.name}</span>${wemedicinelist.standard}</p> </c:forEach> <p> < A href= "#" class= "btn btn_o_c btn_close" id= "Btn_close" > Close </a></p> </dd> <%-- <dt> <i class= "ico ico_recipe Recipe_bg4" ></i> Check project:</dt> <dd id= "Medicine_info_chec K "> <c:foreach items=" ${entity} "var=" entity "begin=" 0 "end=" 1 "> <p><span>${entity.name }</span></p> </c:forEach> <p><a href= "#" class= "btn btn_o_c btn_open" id= "Btn_ Open > Expand </a></p> </dd> <dd id= "Medicine_detail_check" > <c:foreach ite ms= "${entity}" var= "entity" > <p><span>${entity.name}</span></p> </C:FO Reach> <p> <a href= "#" class= "btn btn_o_c btn_close" id= "Btn_close" > Close </a></p> </dd>--%> <dt><i class= "ico ico_recipe recipe_bg5" ></i> other:</dt> <dd> <c : ForEach items= "${otmedicinelist}" var= "Otmedicinelist" > <p><span>${otmedicinelist.name}</span& gt;${otmedicinelist.standard}</p> </c:forEach> </dd> <dt><i class= "ico Ico_recip E recipe_bg2 "></i> treatment Project:</dt> <c:foreach items=" ${trmedicinelist} "var=" Trmedicinelist "> < ;DD ><p><span>${trMedicineList.name}</span>${trMedicineList.standard}</p></dd> </c:forEach> <dd class= "Recipe_sum sum_all" > Total: ${fee} meta </dd> </dl></div></span >
JSP Judging list length