关于JSP中jsp:include的调用问题

linfeng01 2003-11-19 05:16:42
在jsp:include的用法中,所include的文件各变量是相对独立的,
那应该怎么在母jsp和include的各jsp页面之间,
以及include的各jsp页面之间进行变量的传递?
用<script>方法?.top?
thanks。
...全文
77 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
linfeng01 2003-11-19
  • 打赏
  • 举报
回复
我现在的目的是原先已经写好了两个jsp页面,
现在想整合到一起,但是因为两个页面里面很多变量是相同的
会造成混乱,为了避开麻烦,所以用了jsp:include而不用include方法,
如果这样的话,
用jsp:directive include 会不会造成变量的混乱?
如果用
<jsp:include page="xxx">
<jsp:param name="shit" value="fuck"/>
</jsp:include>
中如果要反向传回来呢?就是从xxx传回到母页面。
thanks。
dmhorse 2003-11-19
  • 打赏
  • 举报
回复
No.

<jsp:include page="xxx"> it will include at request time.
so the including page doesn't share the variable.

<jsp:directive include file="xxx"> it will include at translation time.
So,the including page share the variable.

Pass variable

<jsp:include page="xxx">
<jsp:param name="shit" value="fuck"/>
</jsp:include>

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧