• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

url updation in the address bar

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
I have a html which has 2 frames. the top one for some graphics and the bottom one for user interaction ( like searches etc ).
index.jsp: ->
<frameset
rows="318,*"
framespacing=0
frameborder=0>
<frame
scrolling="no"
noresize
marginwidth=0
marginheight=0
name="topFrame"
src="frame1.jsp?nodeCat=<%=request.getParameter("nodeCat")%>&nodeID=<%=request.getParameter("nodeID")%>">
<frame
name="bottom"
src="search_menu.jsp">
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support
them.</p>
</body>
</noframes>
</frameset>
I start the application by saying :
http://localhost:8080/src/index.jsp and the url remains the same for any jsp pages called in the bottom frame.
I would like the url in the address bar to be updated with whatever jsp i call in the bottom frame. How do I do this? I know I am missing something. I also have a ControllerServlet that dispatches tasks to different jsps.
Thanks very much in advance,
Priya.
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that is the biggest drawback in using frames. the url listed in the address bar is the location of the frameset file. which means among other things that you cannot bookmark "pages". as far as i know there is no way around this. you could display the frame url in the status bar i suppose.
 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can sort of hack your way through this by passing data via a fake querystring. If the name of the page holding your frameset is "index.jsp", and you want a link to open your page on coffeeshops in the bottom frame, your link would look like
<a href="index.jsp?coffeeshops.jsp">click</a>
Then index.jsp would contain a script called onload that read the page's location, got the lastIndexOf "?", grabbed the substring from that index to the length of the location string, and set that String to be the src of the bottom frame. That way your users can bookmark the page.
However, you could do it easier using the capabilities of JSP, so your link would be
<a href="index.jsp?page=coffeeshops.jsp">click</a>
and you'd just have to get the parameter "page" and write it to the page in the src of the bottom frame.
hth,
g.
 
Priya Rangan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you both very much.
Garann, if i used your suggestion of something like <a href="index.jsp?coffeeshops.jsp">click</a> and then have a script for onload, wouldnt this cause index.jsp to be reloaded all over again ( and hence even the top frame ) for every jsp called?
If this is the case, then it wouldnt suit me very much since i have a graphical display on the top frame and i wouldnt want it reloaded every time.
reply
    Bookmark Topic Watch Topic
  • New Topic