最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - iframe query string - Stack Overflow

programmeradmin8浏览0评论

I have got the values by passing the query string in an iframe.src = "xyxz.jsp?name="+name+"&pass="+pass+"&id="+id.

I need to pass those values which i have got to another jsp page <iframe src="xyz.jsp"></iframe>

How can i do that?

I have got the values by passing the query string in an iframe.src = "xyxz.jsp?name="+name+"&pass="+pass+"&id="+id.

I need to pass those values which i have got to another jsp page <iframe src="xyz.jsp"></iframe>

How can i do that?

Share Improve this question edited Jun 23, 2010 at 11:14 Alastair Pitts 19.6k9 gold badges71 silver badges98 bronze badges asked Jun 23, 2010 at 11:08 LalchandLalchand 7,82726 gold badges68 silver badges79 bronze badges 1
  • 1 What do you mean by "another jsp page"? Please add more detail to your question. – Pekka Commented Jun 23, 2010 at 11:13
Add a ment  | 

3 Answers 3

Reset to default 2

Your question is unclear, but I guess that you want to pass the querystring of the parent JSP page to the JSP page which is in an iframe of the parent JSP page. If so, then just print HttpServletRequest#getQueryString():

<iframe src="page.jsp?${pageContext.request.queryString}"></iframe>

That said, iframes are an extremely bad practice and very clumsy when all the pages are located at the same server. Rather use server side includes using <jsp:include>. This way the included JSP has access to the same request object.

Use Javascript to dynamically change the src attribute of frame

function changeSrc()
{ 
  window.frames['testframe'].src = "xyxz.jsp?name="+name+"&pass="+pass+"&id="+id;
 }

Is this what are you looking for?

according to your cooment to @Manjoor post you want to call javascript function which is defined inside iframe and pass the parameters to it, if that so check this post
Invoking JavaScript code in an iframe from the parent page

发布评论

评论列表(0)

  1. 暂无评论