2017-05-16 7 views
0

jspページに次の宣言があります。 ここで、b3はstrutsアクションクラスにマップされたケーブルインスタンスです。条件に基づいてDIVを表示

<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; 

%>

と動的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>  

は、どのように私はDIVがあれば表示することができますし、b3がnullでない場合にのみ?どんなJSPテスト条件?

+0

aspテンプレートではなく、HTMLを投稿する方が良いです。 – dfsq

+0

あなたは全体のHTMLを意味しますか? –

答えて

0

trueの場合は、if文の内容のみをレンダリングするので、b3がnullでなければ、それが表示されます。 b3の値を含む変数があれば、これを行うことができます。あなたは十分な情報を入れていませんが、集められたものから、暗い答えの中に私のショットがあります。

関連する問題