Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Function reject.


devel / comp.lang.java.programmer / Re: Is there a good way to wrap a jsp in a jsp?

SubjectAuthor
* Is there a good way to wrap a jsp in a jsp?e.d.pro...@gmail.com
`* Re: Is there a good way to wrap a jsp in a jsp?Arne Vajhøj
 `* Re: Is there a good way to wrap a jsp in a jsp?e.d.pro...@gmail.com
  `- Re: Is there a good way to wrap a jsp in a jsp?e.d.pro...@gmail.com

1
Is there a good way to wrap a jsp in a jsp?

<52c29918-5654-47c5-acd4-b5fe74d43037n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=81&group=comp.lang.java.programmer#81

  copy link   Newsgroups: comp.lang.java.programmer
X-Received: by 2002:ac8:5d86:0:b0:2e1:b9fd:ec24 with SMTP id d6-20020ac85d86000000b002e1b9fdec24mr5172575qtx.290.1647548435206;
Thu, 17 Mar 2022 13:20:35 -0700 (PDT)
X-Received: by 2002:a4a:cf03:0:b0:31d:79a5:ac51 with SMTP id
l3-20020a4acf03000000b0031d79a5ac51mr1965751oos.35.1647548434902; Thu, 17 Mar
2022 13:20:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.java.programmer
Date: Thu, 17 Mar 2022 13:20:34 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=98.237.40.232; posting-account=2czF5goAAAD4GBMPIGV4KcD2K4PhoB_H
NNTP-Posting-Host: 98.237.40.232
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <52c29918-5654-47c5-acd4-b5fe74d43037n@googlegroups.com>
Subject: Is there a good way to wrap a jsp in a jsp?
From: e.d.programmer@gmail.com (e.d.pro...@gmail.com)
Injection-Date: Thu, 17 Mar 2022 20:20:35 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 3
 by: e.d.pro...@gmail.com - Thu, 17 Mar 2022 20:20 UTC

We have a jsp landing page that has a menu and a horizontal line.
Under the horizontal line we want to display the selected menu option which is another jsp, without pasting the main page code into the other file.
The jsp is initially called from a @WebServlet using request.getRequestDispatcher().forward(), and I want to pass variables into the nested jsp.
I use request.setAttribute(), or session.setAttribute() to set variables, and they resolve in the main page jsp but not the nested jsp with any method I could find so far to dynamically display the nested page.

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

<6233c9b5$0$697$14726298@news.sunsite.dk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=82&group=comp.lang.java.programmer#82

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Thu, 17 Mar 2022 19:52:20 -0400
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Subject: Re: Is there a good way to wrap a jsp in a jsp?
Content-Language: en-US
Newsgroups: comp.lang.java.programmer
References: <52c29918-5654-47c5-acd4-b5fe74d43037n@googlegroups.com>
From: arne@vajhoej.dk (Arne Vajhøj)
In-Reply-To: <52c29918-5654-47c5-acd4-b5fe74d43037n@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 24
Message-ID: <6233c9b5$0$697$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: dc7830a5.news.sunsite.dk
X-Trace: 1647561141 news.sunsite.dk 697 arne@vajhoej.dk/68.9.63.232:51831
X-Complaints-To: staff@sunsite.dk
 by: Arne Vajhøj - Thu, 17 Mar 2022 23:52 UTC

On 3/17/2022 4:20 PM, e.d.pro...@gmail.com wrote:
> We have a jsp landing page that has a menu and a horizontal line.
> Under the horizontal line we want to display the selected menu option
> which is another jsp, without pasting the main page code into the
> other file. The jsp is initially called from a @WebServlet using
> request.getRequestDispatcher().forward(), and I want to pass
> variables into the nested jsp. I use request.setAttribute(), or
> session.setAttribute() to set variables, and they resolve in the main
> page jsp but not the nested jsp with any method I could find so far
> to dynamically display the nested page.

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

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

<dd1436df-4ce2-48c4-b702-53ae67e4b429n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=83&group=comp.lang.java.programmer#83

  copy link   Newsgroups: comp.lang.java.programmer
X-Received: by 2002:ac8:7dc8:0:b0:2e1:b3ec:6666 with SMTP id c8-20020ac87dc8000000b002e1b3ec6666mr8132970qte.556.1647620352822;
Fri, 18 Mar 2022 09:19:12 -0700 (PDT)
X-Received: by 2002:a05:6830:1f26:b0:5c9:2515:85f with SMTP id
e6-20020a0568301f2600b005c92515085fmr3486276oth.274.1647620352401; Fri, 18
Mar 2022 09:19:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.java.programmer
Date: Fri, 18 Mar 2022 09:19:12 -0700 (PDT)
In-Reply-To: <6233c9b5$0$697$14726298@news.sunsite.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=98.237.40.232; posting-account=2czF5goAAAD4GBMPIGV4KcD2K4PhoB_H
NNTP-Posting-Host: 98.237.40.232
References: <52c29918-5654-47c5-acd4-b5fe74d43037n@googlegroups.com> <6233c9b5$0$697$14726298@news.sunsite.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dd1436df-4ce2-48c4-b702-53ae67e4b429n@googlegroups.com>
Subject: Re: Is there a good way to wrap a jsp in a jsp?
From: e.d.programmer@gmail.com (e.d.pro...@gmail.com)
Injection-Date: Fri, 18 Mar 2022 16:19:12 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 22
 by: e.d.pro...@gmail.com - Fri, 18 Mar 2022 16:19 UTC

> 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}

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

<a608f687-beb1-4a5a-ab56-82708aef321fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=85&group=comp.lang.java.programmer#85

  copy link   Newsgroups: comp.lang.java.programmer
X-Received: by 2002:a05:620a:444a:b0:67d:2087:c1cd with SMTP id w10-20020a05620a444a00b0067d2087c1cdmr943044qkp.90.1648060855843;
Wed, 23 Mar 2022 11:40:55 -0700 (PDT)
X-Received: by 2002:a05:6870:a90a:b0:da:b3f:3249 with SMTP id
eq10-20020a056870a90a00b000da0b3f3249mr630262oab.249.1648060855535; Wed, 23
Mar 2022 11:40:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.java.programmer
Date: Wed, 23 Mar 2022 11:40:55 -0700 (PDT)
In-Reply-To: <dd1436df-4ce2-48c4-b702-53ae67e4b429n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=98.237.40.232; posting-account=2czF5goAAAD4GBMPIGV4KcD2K4PhoB_H
NNTP-Posting-Host: 98.237.40.232
References: <52c29918-5654-47c5-acd4-b5fe74d43037n@googlegroups.com>
<6233c9b5$0$697$14726298@news.sunsite.dk> <dd1436df-4ce2-48c4-b702-53ae67e4b429n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a608f687-beb1-4a5a-ab56-82708aef321fn@googlegroups.com>
Subject: Re: Is there a good way to wrap a jsp in a jsp?
From: e.d.programmer@gmail.com (e.d.pro...@gmail.com)
Injection-Date: Wed, 23 Mar 2022 18:40:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 11
 by: e.d.pro...@gmail.com - Wed, 23 Mar 2022 18:40 UTC

> >
> > 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}
I found that you can pass values one at a time from one page file to another using import params, but if the page does something, like call a form .submit(), those values get lost.
So to set up constants available to every page as ${variable}, I use request.getServletContext().setAttribute() in a javax.servlet.Filter, which can be in a common module referenced from multiple war modules.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor