Discussion:
unknown
1970-01-01 00:00:00 UTC
Permalink
I managed to make it work by hacking CustomParamsRequest and rebuilding
freemarker.jar. I'm using this for now and i hope it's good enough until i
manage to complete the transition from JSP to ftl.
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.
page1.ftl
...
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
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
FreeMarker-user mailing list
https://lists.sourceforge.net/lists/listinfo/freemarker-user
--047d7b621f54860ab404cc46fcd6
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Yes, that&#39;s correct, I&#39;m only seeing &quot;param1&quot; in both page2.jsp and page3.jsp. I should have mentioned that i&#39;m using tomcat as application server.<br></div><div><br></div><div>I found out why it&#39;s not working, at least for me, after some debugging. The problem comes from the combination of Freemarker&#39;s CustomParamsRequest and apache&#39;s implementation of request wrapping and forwarding. CustomParamsRequest is used to wrap the page&#39;s HttpServletRequest and pass parameters when performing an ftl include_page. It holds the parameters in a map separated from the wrapped request that it only modifies at construction time.
Loading...