Ich habe folgende Deklarationen in meiner JSP-Seite: wo b3 ist eine Kabelinstanz in Struts Aktionsklasse zugeordnet.Zeige DIV basierend auf Bedingung
<s:set var="b3unit" scope="request" value="b3.cableunit"/>
<s:set var="b3sid" scope="request" value="b3.cableid" />
<s:set var="b3tube" scope="request" value="b3.btube"/>
<s:set var="b3fiber" scope="request" value="b3.bfiber"/>
<s:set var="b3id" scope="request" value="b3.cable_user_id" />
<s:set var="b3name" scope="request" value="b3.cable_name" />
<% String b3 = (String) request.getAttribute("b3sid");
String b3_type = "Cable";
String b3_id = (String) request.getAttribute("b3id");
String b3_name = (String) request.getAttribute("b3name");
int b3_tube = (Integer) request.getAttribute("b3tube");
int b3_fiber = (Integer) request.getAttribute("b3fiber");
float b3_tot_height = b3_tube * b3_fiber * 10.8f;
float b3_tube_sec_height = b3_tot_height/b3_tube;
%>
und ein dynamisches DIV:
<div class="type_b" style="margin-left: 1300px; margin-top:-<% out.print((height * 11) + 100);%>px ; height: <% out.print(height);%>px">
<div class="section" style="float: right; margin-left: 55px; height: <% out.print(height);%>px">
<div id="cable_3" class="cable" style="margin-top: <% out.print((b3_tot_height/2)+b_tot_height);%>px"></div>
</div>
<div class="section" style="float: right; margin-left: 55px; height: <% out.print(b3_tot_height);%>px">
<%
for (int y = 1; y <= b3_tube; y++) {%>
<div id="b3tube_<%out.print(y);%>" class="tube" style="margin-top: <%
if (y == 1) {
out.print((b3_tube_sec_height/2)+b_tot_height+30);
} else {
out.print((b3_tube_sec_height));
}
%>px"></div>
<% }%>
</div>
</div>
Wie kann ich die DIV zeigen kann, wenn und nur wenn b3 nicht null ist? JSP-Testbedingungen?
Es ist besser, HTML zu veröffentlichen, keine Asp-Vorlage. – dfsq
meinst du ganze html? –