I am designing a classic "menu-content"-page with the menu located at left and the content located at right. The menu consists of a simple select-box inside a form, and the option values in the select-box are created from a database when the page is loaded. When the user selects an option and submits the form the content is then created from another database using the selected option as input to a SQL-where statement. The application consists of two frames menu.jsp and content.jsp. All this works fine.
From a design-perspective however frames should be avoided and instead the menu and the content should be in the same page using CSS to place each block.
Trying to establish this design in ONE page I have some questions:
- how can I ensure that the menu-part is invoked only when the form is submitted and not if the user clicks on e.g. a link in the content-page? (in the frame-design control is directed to the content.jsp-page when the form is submitted in the menu.jsp-page)
- how can I ensure that establishing the connection to the database is carried out only once when the page is loaded (and the connection should stay open when the page is used) and that the connection is closed when the page is closed?