Re: Passing parameters to included JSP files

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Wednesday, October 17, 2012, 3:06:30 PM, Ionut Prunache wrote:

> I'm working on a project for replacing an existing JSP code base
> with Freemarker. I'm trying to do it progressively, that is I still
> want to be able to include some JSP files from my new Freemarker templates.
>
> The JSP pages that I include directly from .ftl files work fine,
> but there is a problem when a JSP page included from an ftl tries to
> include another JSP page and pass it some parameters. The second JSP
> file loads but doesn't receive the parameters from the calling JSP,
> it only gets the parameters that the .ftl passed to the first JSP.
>
> Here is a short example of the flow:
>
> page1.ftl
> ...
> <@include_page path="/WEB-INF/jsp/page2.jsp" inherit_params=true params={"param1": "param1"}/>
> ...
>
> page2.jsp
> ...
> <jsp:include page="/WEB-INF/page3.jsp">
>     <jsp:param name="param2" value="${someVar}"/>
> </jsp:include>
> ...
>
> request.getParameterNames() only contains param1 for both page2.jsp
> and page3.jsp. I expect page3.jsp to see both param1 and param2.

Just to be sure, you are seeing "param1" only, in both page2.jsp and
page3.jsp, right? (When you try that, just print them, because
getParameterNames might have its own problems.) Then in page2.jsp, the
jsp:include didn't add "param2" to the request. That's the jsp:include
implementation's doing, and I don't see why it's happening. What's the
class of the request object in page2.jsp and in page3.jsp?

> Is there a way for this to work? If so, what am i doing wrong?
>
> Thanks
> Ionut

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.