The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

JSP include directive with a conditional?

Hi, all.

I'm trying to wrap some conditionals around a JSP include directive.  My application allows users to move money in either abstract percentages or whole dollars.  For better or worse, the logic to handle dollars or percentages is split across two pages.  Is there a way to use some sort of conditional logic around the include to have it only bring in one page?  When I attempt to compile this code, it actually includes both of the external pages:

<logic:equal name="type_selection" value="D">
    <%@ include file="include/include_dollars.jsp" %>
</logic:equal>
<logic:equal name="type_selection" value="P">
    <%@ include file="include/include_percent.jsp" %>
</logic:equal>

Thanks,
ICCO

Tuesday, July 15, 2008
 
 
Dan Fleet Send private email
Tuesday, July 15, 2008
 
 
Hi, Dan.

Won't that render the jsp in the include on its own, rather than simply appending it to the jsp that's calling it?

Thanks,
ICCO

Tuesday, July 15, 2008
 
 
Oh I see what you're getting at.  Yea, <jsp:include> gets executed at request time (which is also when conditionals like the <logic> tags are executed). 

At this point I would ask if there's some sort of collision in the definitions of the two files you're including.
Dan Fleet Send private email
Tuesday, July 15, 2008
 
 
Hi, Dan.

I decided to scrap the idea, entirely; I'm building goofy logic of my own on top of existing goofy logic of someone else's.  I should probably render different pages altogether, rather than trying to decide which to include.

Thanks,
ICCO

Tuesday, July 15, 2008
 
 
JSTL? <c:if><include goes here></c:if>

Tuesday, July 15, 2008
 
 
<c:if><c:import ...></c:if>
Michael Bacarella
Friday, July 18, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz