I've come across a few other questions that describe a similar, but not identical situation, to mine. This question, for instance, shows pretty much the same problem, except that I'm not using portlets - I'm just using boring ol' JSP+JSTL+EL+etc.
I have two application contexts, and I'd like to import a JSP from one to the other. I know how do that:
<c:import context="/" url="/WEB-INF/jsp/foo.jsp"/>
However, I also want to pass a parameter to the imported foo.jsp
. But this code:
<c:import context="/" url="/WEB-INF/jsp/foo.jsp">
<c:param name="someAttr" value="someValue"/>
</c:import>
does not seem to properly send the parameter to foo.jsp
; if foo.jsp
is something like*
<% System.out.println("foo.jsp sees that someAttr is: "
+ pageContext.findAttribute("someAttr")); %>
then this gets printed out:
foo.jsp sees that someAttr is: null
whereas I want to see this:
foo.jsp sees that someAttr is: someValue
so, obviously, someAttr
can't be found in foo.jsp
.
How do I fix this?
*(yes, I know, scriplets==bad
, this is just for debugging this one problem)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…