• Welcome to KonaKart Community Forum. Please login or sign up.
 

Checking if a tile exists.

Started by pyr0t3chnician, December 27, 2011, 07:32:53 pm

Previous topic - Next topic

pyr0t3chnician

Hello everyone,
Let me preface this question by letting you know that I work mainly with PHP and can get around with rails and a few other languages/platforms, but I have almost no experience with Java webapps.  I understand what is going on, but to writing my own code is a completely different story.

Anyways, my task at this job is to update KonaKart (done) and then to theme it according to our new website (almost done).  I have the layouts, header, and footer done mostly.  The problem I am having is that the jsp page for the main layout looks like this:


<div class="siderBox noMargin">
    <div class="siderBoxTop"></div>
    <div class="siderBoxContent">
        <tiles:insert attribute="leftTile1" />
    </div>
    <div class="siderBoxBottom"></div>
</div>


The problem is that if leftTile1 has a value of "/WEB-INF/jsp/Empty.jsp", the I get a small blank box.  I want to check if the value of leftTile1!="/WEB-INF/jsp/Empty.jsp" so that I can display the box or hide it if it doesn't exist.  I could go into each tiles .jsp and wrap the content in that html, but there has to be an easier way... I hope.  Any help would be greatly appreciated!  Thanks!

ryan

I think you'd be better off having the layout look like our MainLayout.jsp and adding all of the divs to the tile itself.

pyr0t3chnician

I figured it out and made some modifications after reading up on the tiles strut.  Much better than modifying 20+ jsp files.  I modified the tile_defs and took out the "Empty.jsp" and just made the field blank (ie. ""), and then imported the attribute and checked to see if it was blank.  Thanks for the suggestion though.


  <tiles:importAttribute name="leftTile1" scope="request" />
  <logic:notEqual name="leftTile1" value="">
    <div class="siderBox noMargin">
        <div class="siderBoxTop"></div>
        <div class="siderBoxContent">
           <tiles:insert attribute="leftTile1" />
        </div>
        <div class="siderBoxBottom"></div>
      </div>
    </logic:notEqual>