• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp Frameset Help

 
andrew simac
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI everyone

Here is the problem that I am having. I am designing a website using JSP. THe website is split into two framesets. The left frameset which is a seperate JSP page allows the user to enter an address and submit it. The page allows the user to submit more than one address. Here is the problem that I am having. I need the right frame which is a seperate JSP page to form a list and each time the user submits an additional address it will be added to the list. Does anyone have any idea how I can form the list from what the user enters. Or have any other ideas how to do this. Examples would be great to see also. Thanks
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a couple of possible ways you could do this. But some more information would be helpful. Are these addresses being stored server side at all? And if so, do they need to be retained across sessions, or just the current session? In other words, are these addresses being saved in a Database or session variables, or are they simply passed for page load to page load on your listing page, or saved client side via a cookie. If you are not sure what I mean by retaining the information server side vs client side, or retaining within a session, you should do some reading up on that subject. Most JSP/Servlet books will typically have a chapter or two dedicated to the basics of that subject, and then talk about it throughout other subjects.

In the meantime, here are some options you can think about.

Option 1) When the left frame posts the new address, have it display an intermediary page (which could say something like "processing input"). Then have that intermediary page, via JavaScript, reload the list of addresses is in the right frame, before loading reloading the input form in its own frame. This has a con of being somewhat sloppy and causes extra server hits, and longer client load time after hitting submit.

Option 2) Have a JavaScript function on the page that lists the addresses that simply reloads the page. When the user posts the form on the right frame, it can first trigger the right frame to reload. This option however can introduce some synchronization issues.

Option 3) Have your form submit target the parent window (i.e. the window that holds the frameset). When submitting, reload the entire frame set, which loads (or reloads) a blank input form in the left frame, and reloads the list in the right frame. This is probably the "cleanest" option, but would be easiest to implement if you are also storing the list of addresses server side (in session variables or a database), but you could use a cookie to maintain the list of addresses as well. The JSP for the right frame (i.e. the list) can iterate your collection object that holds the list of addresses, listing then one by one.

Those are some ideas based on some very quick thought about the problem. I am sure there are others. But these should help get you started. Give them a try, and if you run into problems, post the specific problem you are having and someone can help you out.

Good luck, and welcome to JavaRanch.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic