Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39741

Re: Is there a good way to wrap a jsp in a jsp?

Newsgroups comp.lang.java.programmer
Date 2022-03-18 09:19 -0700
References <52c29918-5654-47c5-acd4-b5fe74d43037n@googlegroups.com> <6233c9b5$0$697$14726298@news.sunsite.dk>
Message-ID <dd1436df-4ce2-48c4-b702-53ae67e4b429n@googlegroups.com> (permalink)
Subject Re: Is there a good way to wrap a jsp in a jsp?
From "e.d.pro...@gmail.com" <e.d.programmer@gmail.com>

Show all headers | View raw


> A few ideas: 
> 
> 1) Just (mis)use session to pass the info. 
> 
> 2) Use dynamic include instead of static include and pass 
> info as query parameter. 
> 
> 3) Switch to a master page capable technology like 
> JSF facelets - I seem to recall that there exist 
> a Java web framework that supports master pages via 
> a taglib, but I cannot remember the name. 
> 
> Arne

I've never used Facelets, from what I can tell that may be a better architecture for that sort of thing but would require a full rewrite.
I couldn't figure a solution that passes everything as is, where you can reference ${var} in the parent JSP and ${var} in the nested JSP, but I did find this option seems to work:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:import url="${pagetoload}">
<c:param name="passvar" value="${vartopass}"/>
</c:import>

Then in the nested JSP, have to reference variables like ${param.passvar}

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is there a good way to wrap a jsp in a jsp? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2022-03-17 13:20 -0700
  Re: Is there a good way to wrap a jsp in a jsp? Arne Vajhøj <arne@vajhoej.dk> - 2022-03-17 19:52 -0400
    Re: Is there a good way to wrap a jsp in a jsp? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2022-03-18 09:19 -0700
      Re: Is there a good way to wrap a jsp in a jsp? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2022-03-23 11:40 -0700

csiph-web