我按照产品规格或根据其配置显示数据。如何删除空白数据?
配置显示页面左侧。当用户选择配置时,应该过滤相关数据。 我已经像屏幕尺寸,RAM,HDD,颜色,大小,处理器,光盘驱动器等 并根据它我显示像2GB,4GB,2.2GHz的,蓝,320GB等
数据属性的类别但我的问题是所有类别显示,如果它的子数据存在与否。 我不想显示类别如果子数据不存在像Screen Size
是空白的,那么它不应该显示。
我的JSP代码:
<%
List<String> attribNameList = (List<String>)request.getAttribute("attribName");
List<String> attribValueList = (List<String>)request.getAttribute("attribValue");
List<String> attribDataList = (List<String>)request.getAttribute("attribData");
List<Integer> acfIDList = (List<Integer>)request.getAttribute("attribacID");
List<Integer> acIDList = (List<Integer>)request.getAttribute("acID");
List<String> acNAMEList = (List<String>)request.getAttribute("acNAME");
String aname,aval,adata,acname;
Integer acfid,acid;
for(int i=0;i<acIDList.size();i++)
{
acid=acIDList.get(i);
acname=acNAMEList.get(i);
//Print Category
%>
<a style="color: black;"><%= acname %></a><br>
<%
for(int i1=0;i1<attribNameList.size();i1++)
{
aname = attribNameList.get(i1);
aval = attribValueList.get(i1);
adata = attribDataList.get(i1);
acfid = acfIDList.get(i1);
if(acid == acfid)
{
//Print Attribute
%><br>
<%-- <a><%= aname %></a> --%>
<a><%= aval %></a>
<%
if(adata == null)
{
}
else
{
%>
<a><%= adata %></a>
<%
}
}
}
%>
<br>
<%
}
%>
Here `acIDList` is a attribute category id and `acnameList` is category name list and `acfIDList` is a `foreign key` in attribute_master table so I have put a if condition that when `acID` and `acfID` matches it creates List and under it sub data display.
和aval
是属性值是2,4,2.2, etc.
和adata is for GB, GHz, MP, etc.
所以我想删除acName
是空白。
我不想显示的类别名称,如果不存在的数据,所以应我必须把一些条件上
<a style="color: black;"><%= acname %></a><br>
线。 任何建议,请..
变化如果(酸== acfid)if(酸== acfid &&!aval.equals(“”)) – jsjunkie
只是一个方面的说法,为了得到一个可维护的应用程序考虑将视图(即jsp)从应用逻辑。 – Henry
我认为检查是否(酸 - acfid &&!aval.isEmpty()&&!aname.isEmpty()) – Neha