<c:import url=""/> just so darn powerful

I was doing a small project last night. Youm wouldn't believe how much the ol <jsp:include page=""/> tag has given me problems. First of all, what I was doing was include a JSP page. That included JSP page has a <c:import page=""/> call in it that calls a request to a Servlet, that servlet forwards to another JSP

    ---servlet call [forwards]---->another.jsp

on main.jsp, when I use <jsp:include/>, the page just gets messed up. I didn't have similar problems when working with Struts(or maybe I didn't use this technique but I don't remember). Some of the parts of main.jsp particulary the ones before the <jsp:include/> tag was ommited. Hmmm...

<c:import/> to the rescue again!

Ok, I had no other choice but to use <c:import/>. Why not use just <c:import/> in the first place? I dunno... It's just a matter of preference. I try to use <jsp:include/> whenever including a static page and <c:import/> that has calls to a servlet that forwards to another page. I think that <c:import/> is actually capable of including/importing parts of other external apps/website. Judging from its attribute, <c:import url=""/>, it should be able to do just that. :)
Published 09-06-2006 8:08 PM by lamia
Filed under: ,