为什么jsp:include参数不可见

编程入门 行业动态 更新时间:2024-10-28 05:21:40
本文介绍了为什么jsp:include参数不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

关于访问jsp:param值,我有一个完全相同的基本问题 a>作为此海报;遵循他的榜样对我完全不起作用.通过

I have exactly the same basic question about accessing jsp:param values as this poster; following his example exactly does not work for me. The parameters passed in via jsp:include don't seem to show up in the included file. Is there something peculiar about my setup?

来电者:

<div> <jsp:include page="../../../common/callee.jsp"> <jsp:param name="justinVar" value="primary" /> </jsp:include> </div>

callee.jsp:

callee.jsp:

<i>method 1: [</i><b><%= request.getParameter("justinVar") %></b><i>]</i> <p/> <i>method 2: [</i><b>${param.justinVar}</b><i>]</i> <p/> <i>method 3: [</i><b>${justinVar}</b><i>]</i> <p/>

最终输出:

method 1: [null] method 2: [] method 3: []

更新: 以下解决方法可以起作用,这似乎是错误的,但也许它起作用的事实揭示了一些不起作用的地方.

Update: The following workaround does work, it seems wrong, but perhaps the fact that it works reveals something that is not working.

<c:set var="justinVar" value="justinVARisHere" scope="request" /> <jsp:include page="../../../common/callee.jsp" />

推荐答案

要确定问题所在,请尝试通过在EL中打印${param}或在Java代码中打印HttpServletRequest#getParameterMap()来调试/探索整个地图.它必须提供有关真正地图包含的内容的见识.

To nail down the problem, try to debug/explore the entire map by printing ${param} in EL or HttpServletRequest#getParameterMap() in Java code. It must give insights about what the map really contains.

更多推荐

为什么jsp:include参数不可见

本文发布于:2023-11-15 05:05:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1591402.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:参数   jsp   include

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!