include code fragments in jsp
Posted on 2007-10-16
I have a dozen lines of code that I want to include in every jsp program I am writing for an application. I have Searched EE for ways of doing this, but am more confused than when I started what with <@ include ...,> <jsp:include ...>, etc. I am successfully using <%@ include file="..." %> to include html in my web page. That's not what I want. I want to include jsp code as if it were in-line with the rest of my code. I have tried: %> <%@ include file="myFragment.jsp"%><%, but that actually dumps the code onto the web page! And my program ends up missing the lines and not executing the logic. Same thing happens with <jsp:include page="dbConnection.jsp"/>
How to I actually include CODE that is executed in-line?